Recently I found this Java implementation by Charles Hayden of the classic Eliza program. I changed the code a little bit to have it compiled as a Processing library that you can use in your sketches.
Here is a sample program I wrote with the library.
Click here to download the compiled library. Unzip the file and place its contents inside the libraries folder under the Processing location. And here you have the source code.
From what I read, and some tests I made, it seems to be a very faithful implementation of the original Eliza algorithm. I was able to reproduce a conversation presented in the 1966 paper by Eliza’s creator, Joseph Weizenbaum.
The library is easy to use. Just import it, and then create an Eliza object:
eliza = new Eliza(this);
String response = eliza.processInput(“Hello”);
You can use the readScript() funcion to change the script that Eliza uses to construct its answers:
To go back to the default script that is loaded when Eliza is initialized, call the readDefaultScript() function.
Instructions to modify the script file are available here.