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 |
Assembly a reply from a decomp rule and the input. |
public void |
Process a line of script input. |
String |
Decompose a string according to the given key. |
public boolean |
|
public boolean |
|
public void |
Print the stored script. |
public String |
Process a line of input. |
public int |
|
public void |
|
int |
|
String |
Process a sentence. |
public void |
|
final boolean echoInput = false
final static int failure = 1
boolean finished = false
String finl = "Goodbye."
Final string
final static int gotoRule = 2
String initial = "Hello."
Initial string
The key list
Key stack
Memory
The post list
The pre list
final boolean printData = false
final boolean printInitialFinal = false
final boolean printKeys = false
final boolean printPrePost = false
final boolean printSyns = false
Quit list
final static int success = 0
The syn list
TextArea textarea
TextField textfield
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.
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.
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;
public boolean finished()
public boolean handleEvent(Event event)
public void print()
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.
(1) Make pre transformations.
(2) Check for quit word.
(3) Scan sentence for keys, build key stack.
(4) Try decompositions for each key.
public void setFinished(boolean isFinished)