How to enable N.I.A.L.L.'s algorithm in a bot? |
I am looking for a way to enable N.I.A.L.L.'s (Non-Intelligent Acquired Language Learner) algorithm in a bot's brain.
"N.I.A.L.L. -- by MacGyver Serdyuk 2009 How it works Niall attempts to learn English, or whatever language you care to teach it, by breaking down the sentences you type in, remembering words, connections between words, the number of times a particular connection has occured, and start/end sentence markers. The best way to explain is by example. Suppose the first sentence you typed was: "The large magnesium roll was next to the old mans desk" Niall would split the sentence into separate words and store any new words it found (Niall's vocabulary is initially blank). It would then store the following information: 1. The word "the" can begin a sentence. Therefore after analysing this sentence, Niall has learnt 10 new words and knows that the word "the" can not only start a sentence but also join onto both "large" and /---------------<---------------<----------------<---------------\ Niall then replies to your sentence by picking a random word which can begin the sentence, followed by one of the words which can join onto it selected at random, then one which can join onto it, and so on until the end of sentence marker is reached. Therefore, Niall may reply to your first sentence like so: "The old mans desk." The more sentences you type in the more words Niall will learn, the more connections it will make and the more original the replies will seem. Replies must be taken with a pinch of salt since the grammar will be anything but perfect. A semi-intelligent version which attempts to learn grammar too, may appear at a later date. Niall also remember the number of times a particular connection is made in order to weight the replies and make them sound more realistic. For example, if the second sentence you type is: "The old dictaphone was hidden" Niall now knows that the word "the" joins onto the word "old" more often than it joins to "large". The table above now looks like this: /------------<-------------------<----------------<---------------\ Niall could now reply: "The old dictaphone was next to the old mans desk." NIALL builds up a vocabulary in this way. If you had typed in the two sentences above, then the output would look like this: 0: > 2| 1(2) Word 0 (>) is an empty word which is used to start the sentence. The 2| means that there are 2 possible next words, and the 1(2) means that both those possibilities are word 1 (the). The word -1 (as in 12: hidden 1| -1(1)) means end-of-sentence." |
|
|
|
|