Our aim is to explore whether Prolog facilitates simple creation of a chatbot capable of NLP for vacation planning. We want to expand on the geographyq.pl example from class, providing more of a chat-type interface and more possible constraints to queries. The most important of these new constraints involves the activities or sights a country has to offer.
The chatbot will implement a form of memory about activities or sights the user likes and what they've already had suggested. The former can be told to the chatbot explicitly and stored for further queries, while the latter can be used to find fresh results under the same criteria. Furthermore, robustness is added to the program as a whole, making sure that ill-formed sentences do not break the IO stream and instead give a natural reply indicating the chatbot did not understand what was asked correctly, and if the user could rephrase what they said. Flexibility is also added in terms of the user input, where infinitive verb forms of preference statements (i.e. I like to hike) are converted into the appropriate present participle (-ing: likes(hiking)) depending on their ending case (ends with -ee, -ie, -e, -consonant, etc.) This allows the program to standardize predicates which may have differing input strings but symbolize the same property.
We learned Prolog queries are intuitive for this kind of task (although the IO was not as intuitive as Haskell), though difficult to scale in terms of functionality. The way Prolog handles pattern matching allowed for easy creation of cases for the chatbot (which also uses negation as failure to make sure it's not confusing cases). Difference lists lent themselves well to the new variable additions, but the threading of memory throughout every function quickly became hard to keep track of. The task required more serious bookkeeping with regards to how everything fits together, as it quickly became hard to debug issues with sentences we expected to work. The chatbot currently remembers and retrieves names, places, and user preferences as constraints on top of those like language or continent. It does not handle most requests larger than one normal modifying phrase combined with one request for preferences to be taken into account. This would likely require creating verb phrases and other units of speech, defined (sometimes recursively) in terms of the existing ones. Complex structures like those would require a full commitment to robust parse trees.