ICS 171 Homework #15

For this assignment, you will need to extend the grammar (in question-answering.lisp) and the database (in patients) to answer more questions. In order to test your system, you will need to use two people in the database. Choose the two people whose first names begin with the first letter of your first name and the first letter of your last name. (If your first and last name begin with the same letter, use the second letter of your last name). We'll call these people X and Y below.

1. (40) Add a height attribute to X and Y in the database.
Make up a different height for each
Add the word "tall" to the grammar.

Test your extension on things like:

"How tall is X" - Use (answer-question `(how tall is X))
"How tall is Y"
"What is the height of X"

(load "unify")
(load "fast-traced-prove")
(load "dcg")
(load "patients")  ;;change to add some heights
(load "question-answering")  ;;change grammar 
(store-clauses *sick-people*)  
(store-clauses (convert-rules *question-rules*))

Make sure it can also answer things like "How tall is the mother of X" (provided X has a mother. If neither X or Y has a parent, make one the mother or father of the other by changing the database).

2. (60) Extend the grammar so that it answers comparative questions:

"Is X taller than Y"
"Is X shorter than Y"
"Is X older than Y"
"Is X younger than Y"

The answer should be something like "Yes. The height of X is 5. The height of Y is 4." However, your extended grammar must not accept "Is X tall than Y ?" since this isn't valid English.

Note that the "dictionary" entry for the word "taller" must indicate it refers to height and it does a "greater than" comparison. The "dictionary" entry for the word "shorter" must indicate it refers to height and it does a "less than" comparison. The easiest way to print the correct answer is to use (say-value ?attr ?object) twice to print "The height of X is 5. The height of Y is 4." and to write a new Lisp function that prints "Yes" or "No" according to its parameters
1. A number (corresponding the height of X)
2. A number (corresponding to the height of Y)
3. A symbol (such as greater or lesser) to indicate whether it should do a greater or less than comparison.

Extra credit:

Get the system to answer questions expressed in some language other than English (e.g., Spanish, Vietnamese, Mandarin Chinese, etc.). The answer should be produced in English. You should not need to change the database at all. (Hint: look how synonyms are done in English). Make sure the system can understand all of the types of questions discussed in class and in this homework assignment.


Back to http://www.ics.uci.edu/~pazzani/171-p.html (text only) or http://www.ics.uci.edu/~pazzani/171.html .

Michael Pazzani
Department of Information and Computer Science,
University of California, Irvine
Irvine, CA 92717-3425
pazzani@ics.uci.edu