From UBC Wiki


Authors: Johnson Huang, Brian Chen and Erik Cui

Source Code

What is the problem?

State the general problem. If applicable, tell us what information you will use, e.g., a link to some web site that provides the information you used. What will you do?

We can all relate to the situation where we are hungry, but cannot decide on what to eat. To help solve this issue, we will create the Restaurant Recommendation Bot. The user can enter information about what they like, i.e pizza, fast food, Japanese, etc, and our bot will respond with the places that fits the criteria. Types of query we can support:

  • I like to eat pizza.
  • I like to eat ramen and sushi.
  • I like to eat ramen or pizza.
  • I like to eat fast food but not pizza.
  • I don’t want to eat noodle, pizza, and sushi.
  • I want to eat cheap food.

Information we will use to create our knowledge base:

What is the something extra?

Dynamically adding to our knowledge base through user inputs: A new place called Sausage in a Bun open and it serves hotdog.

  • Pizza Hut now serves burger.
  • Pizza Hut no longers serves hotdog.
  • Pizza Hut has closed down.
  • Sushi House has opened.

What did we learn from doing this?

Triples allowed us to efficiently store and query facts without needing an enormous knowledge base. Had we used facts such as “restaurant(mcdonalds).”, our knowledge base would have been significantly larger. Anything more complex than triples would have been needlessly more complex since all relationships could be described through triples. With difference lists in Prolog, we were able to easily pattern match and draw conclusions from the knowledge base with a relatively small program, which is not achievable in several more mainstream languages like Java, Javascript, or Python.

Natural language processing with respect to Prolog representations of context free grammar was "doable" but supporting more and more types of question structures resulted in a significant increase in the complexity of the code. This is in reference to adjectives and nouns and their negation counterparts that become more and more verbose as more question lists were supported. Perhaps knowledge of Prolog design patterns could have resulted in code that was more clean / readable and expandable with regards to adding more sentence structures.

Tracing the program became exceedingly difficult as the program became more complex with additional queries. Tracing smaller portions at a time (eg. only tracing “noun” or “verb”) and ensuring they were correct before continuing to the larger predicates allowed us to more efficiently debug the code.

String manipulation for user input of new restaurants: We want to convert user input restaurant names into Prolog constant IDs (i.e. “Red Burrito” => redburrito) but Prolog didn’t seem to have good support for that. We were able to turn list of strings into a single delimited string though.