ECTOR, the chatterbot.
ECTOR is a project of a chatterbot, that tries to learn from the utterers' entries.  
It has several version (including an online one, written in PHP/MySQL), but the last one, and most up-to-date is written in C, and runs under Linux (or Windows, but with less accuracy).  
The fun is to download its C version, and run it. Now, you can teach it what you want, and see what it learns, "understand", and replies!