Class Eliza
package: net.jxta.myjxta.misc.eliza
public class Eliza
Eliza main class. Stores the processed script. Does the input transformations.
Field Summary
final boolean
final static int
boolean
String
   Final string
 
final static int
String
   Initial string
 
   The key list
 
   Key stack
 
   Memory
 
   The post list
 
   The pre list
 
final boolean
final boolean
final boolean
final boolean
final boolean
   Quit list
 
final static int
   The syn list
 
TextArea
TextField
Method Summary
String
assemble(Decomp d, String reply, Key gotoKey)
   Assembly a reply from a decomp rule and the input.
 
public void
collect(String s)
   Process a line of script input.
 
String
decompose(Key key, String s, Key gotoKey)
   Decompose a string according to the given key.
 
public boolean
public boolean
handleEvent(Event event)
public void
   Print the stored script.
 
public String
processInput(String s)
   Process a line of input.
 
public int
readScript(boolean local, String script)
public void
response(String str)
int
runProgram(String test, Panel w)
String
sentence(String s)
   Process a sentence.
 
public void
setFinished(boolean isFinished)
Field Detail
echoInput
final boolean echoInput = false

failure
final static int failure = 1

finished
boolean finished = false

finl
String finl = "Goodbye."
Final string

gotoRule
final static int gotoRule = 2

initial
String initial = "Hello."
Initial string

keys
KeyList keys = new KeyList()
The key list

keyStack
KeyStack keyStack = new KeyStack()
Key stack

lastDecomp
DecompList lastDecomp

lastReasemb
ReasembList lastReasemb

mem
Mem mem = new Mem()
Memory

post
PrePostList post = new PrePostList()
The post list

pre
PrePostList pre = new PrePostList()
The pre list

printData
final boolean printData = false

printInitialFinal
final boolean printInitialFinal = false

printKeys
final boolean printKeys = false

printPrePost
final boolean printPrePost = false

printSyns
final boolean printSyns = false

quit
WordList quit = new WordList()
Quit list

success
final static int success = 0

syns
SynList syns = new SynList()
The syn list

textarea
TextArea textarea

textfield
TextField textfield
Method Detail
assemble
String assemble(Decomp d, String reply, Key gotoKey)
Assembly a reply from a decomp rule and the input. If the reassembly rule is goto, return null and give the gotoKey to use. Otherwise return the response.

collect
public void collect(String s)
Process a line of script input.

decompose
String decompose(Key key, String s, Key gotoKey)
Decompose a string according to the given key. Try each decomposition rule in order. If it matches, assemble a reply and return it. If assembly fails, try another decomposition rule. If assembly is a goto rule, return null and give the key. If assembly succeeds, return the reply;

finished
public boolean finished()

handleEvent
public boolean handleEvent(Event event)

print
public void print()
Print the stored script.

processInput
public String processInput(String s)
Process a line of input.

readScript
public int readScript(boolean local, String script)

response
public void response(String str)

runProgram
int runProgram(String test, Panel w)

sentence
String sentence(String s)
Process a sentence. (1) Make pre transformations. (2) Check for quit word. (3) Scan sentence for keys, build key stack. (4) Try decompositions for each key.

setFinished
public void setFinished(boolean isFinished)