home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.yorku.ca 2015 / ftp.cs.yorku.ca.tar / ftp.cs.yorku.ca / pub / peter / elizakit.sea.bin / elizakit / instructions.txt < prev    next >
Text File  |  2003-06-10  |  3KB  |  129 lines

  1. How Eliza Works
  2.  
  3.  
  4.  
  5. All the behavior of Eliza is controlled by a script file.
  6.  
  7. The standard script is attached to the end of this explanation.
  8.  
  9.  
  10.  
  11. Eliza starts by reading the script file.  Because of Java security, it
  12.  
  13. must be on the same server as the class files.  Eliza then reads a line at
  14.  
  15. a time from the user, processes it, and formulates a reply.
  16.  
  17.  
  18.  
  19. Processing consists of the following steps.
  20.  
  21. First the sentence broken down into words, separated by spaces.  All further
  22.  
  23. processing takes place on these words as a whole, not on the individual
  24.  
  25. characters in them.
  26.  
  27. Second, a set of pre-substitutions takes place.
  28.  
  29. Third, Eliza takes all the words in the sentence and makes a list of all
  30.  
  31. keywords it finds.  It sorts this keyword list in descending weight.  It
  32.  
  33. process these keywords until it produces an output.
  34.  
  35. Fourth, for the given keyword, a list of decomposition patterns is searched.
  36.  
  37. The first one that matches is selected.  If no match is found, the next keyword
  38.  
  39. is selected instead.
  40.  
  41. Fifth, for the matching decomposition pattern, a reassembly pattern is
  42.  
  43. selected.  There may be several reassembly patterns, but only one is used
  44.  
  45. for a given sentence.  If a subsequent sentence selects the same decomposition
  46.  
  47. pattern, the next reassembly pattern in sequence is used, until they have all
  48.  
  49. been used, at which point Eliza starts over with the first reassembly pattern.
  50.  
  51. Sixth, a set of post-substitutions takes place.
  52.  
  53. Finally, the resulting sentence is displayed as output.
  54.  
  55.  
  56.  
  57. The script is used to construct the pre and post substitution lists, the
  58.  
  59. keyword lists, and the decomposition and reassembly patterns.  
  60.  
  61. In addition, there is a synonym matching facility, which is explained below.
  62.  
  63.  
  64.  
  65. Every line of script is prefaced by a tag that tells what list it is 
  66.  
  67. part of.  Here is an explanation of the tags.
  68.  
  69.  
  70.  
  71. initial:    Eliza says this when it starts.
  72.  
  73. final:        Eliza says this when it quits.
  74.  
  75. quit:        If the input is this, then Eliza quits.  Any number permitted.
  76.  
  77. pre:        Part of the pre-substitution list.  If the first word appears in 
  78.  
  79.             the sentence, it is replaced by the rest of the words.
  80.  
  81. post:        Part of the post-subsititution list.  If the first word appears 
  82.  
  83.             in the sentence, it is replaced by the rest of the words.
  84.  
  85. key:        A keyword.  Keywords with greater weight are selected in 
  86.  
  87.             preference to ones with lesser weight.
  88.  
  89.             If no weight is given, it is assumed to be 1.
  90.  
  91. decomp:        A decomposition pattern.  The character * stands for any 
  92.  
  93.             sequence of words.  
  94.  
  95. reasmb:        A reassembly pattern.  A set of words matched by * in 
  96.  
  97.             the decomposition pattern can be used as part of the reassembly.
  98.  
  99.             For instance, (2) inserts the words matched by the second * 
  100.  
  101.             in the decomposition pattern.
  102.  
  103. synon:        A list of synonyms.  In a decomposition rule, for instance, @be
  104.  
  105.             matches any of the words "be am is are was" because of the line:
  106.  
  107.             "synon: be am is are was".  The match @be also counts as a *
  108.  
  109.             in numbering the matches for use by reassembly rules.
  110.  
  111.  
  112.  
  113. Other Special Rules
  114.  
  115. If a $ appears first in a decomposition rule, then the output is formed as
  116.  
  117. normal, but is saved and Eliza goes on to the next keyword.  If no keywords
  118.  
  119. match, and there are saved sentences, one of them is picked at random and
  120.  
  121. used as the output, then it is discarded.
  122.  
  123. If there are no saved sentences, and no keywords match, then it uses the
  124.  
  125. keyword "xnone".
  126.  
  127.  
  128.  
  129.