eliza.py, ELIZA in Python
This is a little version of ELIZA, a famous natural-language AI demo from the 1960s, packaged up as a Python module. It's all smoke and mirrors; the program doesn't have a clue what it is saying and it's not difficult to catch it out. It's amusing, and it means your chatbot always has something to say.
I adapted Joe Strout's original implementation for Python 2 and packaged it as a module. He's given me his permission to release it.
The eliza.py module includes an interactive mode, so you can get a feel for how it performs. Simply unpack the download and
python eliza.py. To use the it from with in your own script do something like
import eliza therapist = eliza.eliza() while(some_condition) #get input from somewhere reply = therapist.respond(input) #send reply somewhere
Talk to ElizaIf you have Yahoo Messenger, you can talk to it here
J. Weizenbaum, ELIZA - A Computer Program For the Study of Natural Language Communication Between Man And Machine Communications of the ACM, Vol 9, No 1, January 1966
There is a online version of the script at http://toms-projekte.de/Eliza/
by Tom [e] [w] on 28th Jun 2009
According to the official Python documentation (http://docs.python.org/release/2.4/lib/module-whrandom.html), whrandom is now depreciated: use the random module instead.
Therefore, if you get the error "python: ImportError: No module named whrandom", in eliza.py:
* line 12, replace "import whrandom" by "import random"
Thanks! Ported this to GoLang:[Add a comment]
by anonymous on 4th Mar 2015