gNiall -- The GNOME Non-Intelligent AMOS Language Learner Gary Benson <rat@spunge.org> http://rat.spunge.org ========================================================= gNiall attempts to learn whatever language you try to teach it by breaking down the sentences and remembering the connections between words. See `How it works' for more details, or see `How to use it' to find that out. It is a complete rewrite of an Amiga program, Niall, that was written by Matthew Peck in 1990. Contents -------- Installation No GNOME? How to use it History How it works Installation ------------ To install gNiall on your system you need GNOME installed, and of course all the things that GNOME needs. See http://www.gnome.org for details about that. Once you have untarred the sources, cd into the gNiall directory and type: ./configure make su make install Then, you can type gNiall anywhere and it will run. If you get fed up of it, then you can remove it by typing: su make uninstall from the directory containing the source. The file INSTALL contains generic instructions for using the configure script, or you can type ./configure --help to see a list of options. No GNOME? --------- If you don't have GNOME, there is a console-only version. Inside the gNiall directory, type: mv otherStuff/console.c . gcc niall.c console.c -o cNiall And you will have a console-only version to play with. There are some commands to do various things: #new - Clear the dictionary #load - Load a dictionary #save - Save the dictionary #list - List the dictionary #correct - Correct a spelling #exit - Quit But it isn't nearly as pretty or easy to use as the GNOME version. How to use it ------------- This is simplicity itself. At the bottom of the window is a box into which you can type sentences. It is not necessary to finish your sentence with a full stop if you only type one sentence, but you can type more than one in at once, separated by full stops. It is perfectly legal to type: The cat sat on the mat. The cat was called George. Niall treats commas as if they were full stops, so it is probably better to just omit them. Once you press return, Niall will then reply and you can enter another sentence. If you just press return without entering anything, Niall will say something anyway. If you just press return when Niall has no vocabulary, the message "I cannot speak yet!" will be displayed. After a while, you can build up huge dictionaries of words, and it will merrily talk rubbish at you. What fun! The dictionaries can be saved and loaded using the entries in the file menu, and there is also the facility to correct mis-spelt words. Selecting `View Dictionary' from the File menu will produce a representation of the dictionary, which is explained in more detail in the `How it works' section below. History ------- The original Niall was written in AMOS, a kind of BASIC for Amigas, but it could only cope with about 500 words and, of course, could only be used if you had an Amiga (or an emulator). So I rewrote it in C, mainly to learn how to write GNOME programs, and to find out how automake/ autoconf works. If you are interested, the original AMOS source is in the otherStuff directory, as is its original documentation. The functional enhancements made in gNiall are: * The number of words that Niall can remember are now limited only by the amount of memory that you have. * Mis-spelt words may be corrected in a more wholesome way than before. How it works (nearly verbatim from the original manual) ------------------------------------------------------ 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 occurred, and start/end sentence markers. The best was to explain is by example. Suppose the first sentence you typed was: The large green tree was next to the old red shed 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. 2.....The word LARGE can follow the word THE. 3.....The word GREEN can follow the word LARGE...etc 4.....The word SHED can end 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 by also join onto both LARGE and OLD. This can be expressed as follows: /----------<---------------<----------------<----------\ (Start)\-THE --- LARGE -- GREEN -- TREE -- WAS -- NEXT -- TO--/ \ \--- OLD --- RED --- SHED(End) 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 red shed. 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 garden gate was blue 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: /----------<---------------<----------------<----------\ (Start)\-THE --- LARGE -- GREEN -- TREE -- WAS -- NEXT -- TO -/ \\ / / === OLD - RED - SHED (End) / -BLUE (End) \ / - GARDEN - GATE-/ Niall could now reply: The old garden gate was next to the old red shed. To look at the vocabulary that Niall has built up, select `View Dictionary' from the File menu. If you had typed in the two sentences above, then the output would look like this: 0: > 2| 1(2) 1: the 3| 8(2) 2(1) 2: large 1| 3(1) 3: green 1| 4(1) 4: tree 1| 5(1) 5: was 2| 13(1) 6(1) 6: next 1| 7(1) 7: to 1| 1(1) 8: old 2| 11(1) 9(1) 9: red 1| 10(1) 10: shed 1| -1(1) 11: garden 1| 12(1) 12: gate 1| 5(1) 13: blue 1| -1(1) 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 `13: blue 1| -1(1)') means end-of-sentence. ========================================================= Gary Benson <rat@spunge.org> http://rat.spunge.org
