The original ELIZA application was 200-odd lines of code. The Python NLTK implementation is similarly short. An excerpt is provided from NLTK's website (http://www.nltk.org/_modules/nltk/chat/eliza.html):
As you can see from the code, input text was parsed and then matched against a series of regular expressions. Once the input was matched, a randomized response (that sometimes echoed back a portion of the input) was returned. So, something such as, I need a taco would trigger a response of, Would it really help you to get a taco? Obviously, the answer is yes, and, fortunately, we have advanced to the point that technology ...