/* TEACH CHAT0 A.Sloman Oct 2011 -- Introduction ------------------------------------------------------- This is the first of a series of short tutorial files concered with making a small, but expandable chatbot, using Pop11, especially the Pop11 matcher. The files are based on the TEACH RESPOND file. This file merely introduces the format of these teach files, for practice with dealing with an error when the whole file i This version is a mixture of compilable pop11 code and commented out tutorial text. Because it is compilable, at any time you can edit and example or a collection of procedure definitions and recompile. However, if you have changed something there may be a 'mishap'. You'll need to look at the mishap line number and try to work out how to fix the file. An example follows: it is not legal pop11 so if you compile the whole file by doing ENTER l1 RETURN you will get an error message in an output.p file. See now the error relates to the faulty instructin, then delete the faulty instruction. */ ;;; A faulty instruction -- syntax error -- Found "]", expecting ")" ;;; sqrt( 99 ]) => /* Now delete that faulty line. That was a syntax error (compile-time error). But you can also get a run-time error (semantic error), as the next example will demonstrate. Again do this to compile the whole file: ENTER l1 RETURN */ ;;; The first line is fine, but not the second line length([99]) => sqrt([99]) => /* Fix the above command to make it print out the square root of 99 (or some other number). Then do ENTER l1 RETURN again, to make sure it works. Then delete both the above tests. Key F4 should delete the line the cursor is on. ENTER d RETURN Each comment uses the Pop11 comment brackets /* */ which look like the comment brackets in C and some other languages. Try compiling the whole file, ENTER l1 The table of contents is near the end, followed by a command to print out 'Successfully compiled'. If necessary, read TEACH MINIVED for revision. You will need to know how to mark and compile a range of text in Ved, how to save your file, how to return to it later. */ ;;; You may wish to remove this command later: 'Starting to compile TEACH CHAT1' => /* -- What this is about ------------------------------------------------- With the help of this TEACH file you will build a simplified ELIZA program, that can hold a 'conversation' in English. The original Eliza was a half-serious exercise in natural language processing developed by Joseph Weizenbaum at MIT in the USA. It loosely simulated a non-directive Rogerian psychotherapist. Many text books on AI include an account of Eliza, and a criticism of the techniques used, because they are so limited. -- Play with the online pop11 for a few minutes. ---------------------- There is a version of the Pop-11 Eliza available on the internet here: http://www.cs.bham.ac.uk/research/projects/cogaff/eliza If you try playing with it see if you can work out some of the rules it uses. That is very hard to do because it has a large collection of rules and the order in which they are tried is randomly 'shuffled' before each new sentence is processed. ======================================================================= -- Further reading ---------------------------------------------------- TEACH READLINE gives more practice in using readline, and shows how to build a toy interactive teaching program for arithmetic. TEACH DEFINE gives more information about defining procedures. TEACH MATCHES explains the use of the matcher in more detail TEACH MATCHES2 gives more information about the matcher. HELP MATCHES gives a summary overview TEACH LISTS and TEACH ARROW give exercises in list processing. TEACH WHYSYNTAX explains why a grasp of syntax is required for understanding natural language. TEACH GRAMMAR Gives an introduction to formal grammars and programs that analyse the structure of a sentence. This helps to explain why the pattern matching approach used by Eliza is not adequate in general. The Pop-11 primer gives a lot more information on lists and the matcher. You can browse it online with the command: TEACH PRIMER Finding things in it requires you to use the editor search mechanism. In particular, Chapter 6 gives a lot of information about lists, and Chapter 7 about the Pop-11 pattern matcher and database. Depending on your installation, there may be a file called TEACH LOCALINDEX giving a list of locally produced teach files TEACH INDEX summarises available teach files supplied with Poplog. TEACH TEACHFILES gives an annotated list of available teach files supplied with Poplog See also the Computers and Thought book by Sharples et al. (MIT Press) You can learn from it how to go beyond Eliza to programs that use a grammar and have a deeper understanding. ======================================================================= */ /* CONTENTS - (Use ENTER g to access required sections) -- Introduction -- What this is about -- Further reading */ 'Successrully compiled whole file' => /* --- $usepop/pop/teach/chat1 --- Copyright University of Birmingham 2011. All rights reserved. ------ */