Now that we have a testable version of Eliza and one that supports synonyms,
it's time to add all the remaining patterns, synonyms and decomposition/reassembly
rules. As we do this, we'll also add or update the corresponding pattern tests
so that our test app is up to date.
It's important that your tests mirror your current code. If you add new
functionality but don't write corresponding tests, be prepared for sleepless
nights.
The generic response patternThe first pattern in Eliza's script is the one that causes Eliza to respond with a generic response when it can't map the user's input to a pattern. The current version of Eliza just displays this string when it encounters user input it can't "understand".![]() ![]() ![]() ![]() ![]() ![]() Adding all synonymsNow it's time to add the remaining synonyms. We'll do this in a separate method called InitializeSynonyms() and call that from Eliza's Initialize() method.![]() Adding all patternsAfter adding all the synonyms, we can go ahead an add the remaining patterns and update existing patterns that referred to synonyms.![]() ![]() ![]() Tweaking the pattern selection logicIf you run Eliza and tell give it the input "I like chocolate.", it responds with a null response.![]() ![]() ![]()
![]() ![]() Where we've come
Congratulations on following Eliza's journey so far!
Eliza is a far cry from its initial version in which it simply echoed the user's
input like a parrot.
![]() ![]() Next stepsEliza is looking very close to Joseph Weizenbaum's creation. Next, we'll improve upon Eliza's generic response generator and add a few other goodies! |