Dynamic Graph Drawing
A non intelligent language learner
This Java applet is an implementation of a non intelligent language learner based on many of its predecessors, such as NIALL. The way in which it 'learns' is similar to the way the Monty PircBot works (although the PircBot version is more advanced, offering weighted edges and other mechanisms for generating sentences). It looks at the things that you (the User) says and remembers which words can start a sentence, which words can end a sentence and which words can follow other words.
When you start to speak to Monty, you will notice that a directed graph forms in the display area. This shows a dynamic graphical representation of the data structures inside the applet. A force-directed drawing algorithm is constantly applied to the graph to keep its layout reasonable.
Remember, Monty can only learn from what you teach it! You will notice the best effects if you try to avoid entering very short sentences.
How does it work?
When creating a sentence, Monty starts at the [start] node. This simple model then picks a random edge that emanates from the [start] node. The node at the other end of the chosen edge becomes the first word of the sentence. We then visit a node via another randomly chosen edge, and so on, until we reach the [end] node.
If we say
hello there monty then Monty will learn that
can start a sentence and that
monty can end a sentence. It will
also be aware that the word
monty can follow
there can follow
At this point, Monty can only reply with
hello there monty because this
is the only thing that it has been taught. Let's now suppose that we say
there are two dogs then Monty learns that
two which in turn can follow
can also follow
there. Now Monty is now aware that it can start a
sentence with either
there. Note also that
Monty now knows that the word
there can be followed by either
are. Already, a random path taken from [start] to
[end] through the directed graph can be used to produce new responses that
we ourselves have not actually said, for example
hello there are two dogs or
As you enter more sentences into Monty, you will see a denser graph start to form, thereby providing a lot more scope for generating 'unseen' phrases.
If you want to put some similar sentence-generator into your own Java programs, you could implement this (it's quite simple if you have a basic knowledge of Java data structures), or you could use the JMegaHal package, which is more effective and its already written for you! JMegaHal uses 4th-order Markov chains instead of the single order ones used by this java applet, which means you are likely to get "better" responses and punctuation will also be mimicked.
This software product is OSI Certified Open Source Software, available under the GNU General Public License (GPL). Since the GPL may be too restrictive for use in proprietary applications, a commercial license is also provided.
Purchase a commercial license for this software.
Search this site
Copyright Paul Mutton 2001-2013