cps721: questions about the 4th assignment.  

Questions related to the 4th assignment

This page contains questions from students and my answers to them. If a question is asked that has already been answered, then I will not post another answer. So if your questions seems to go unanswered, you should check over previous questions.

Q1
I just had a question about ``the''. When using "the" it will only apply to noun phrases such that it will only succeed if there's only one unique entity. So if there's a brother from Toronto of a canadian from Ottawa and a brother from Hamilton of a canadian from Ottawa then the query the brother of a canadian from Ottawa will fail since there's are two distinct persons. For this to succeed there can only be one person who is the only one brother of some canadian person living in Ottawa.
A1
Yes, you understand this correctly.

Q2
Just a quick question: we are only allowed to use the predicates mentioned in the database or can we add new predicates to that?
A2
Please read more carefully the sentence in the middle of Page 2 in the assignment, after the list of words to be included in the lexicon. You are not supposed to add new predicates to your database. The predicates given to you in Part 1 are sufficient to define meaning of all words in your lexicon. Note your database may include atomic statements and rules. Remember that your program should handle all English words in the examples given to you.
I'll ask the TA to give the 1st and 2nd prizes to programs that will be the most creative and versatile in terms of their linguistic abilites. You can expand your lexicon and handle larger vocabulary, you can try to handle also yes/no questions in addition to the noun phrases. (You can try to handle declarative sentences too, if you like, but this will require more work: to handle them your program should be able to update your database dynamically). The best assignments (who will win this competition) will be awarded extra marks.

Q3
When we start question 1, our database is very small, and it only satisfies the queries we are required to make. Once we start part 2, our database expands, where we need to add new facts to satisfy the test queries given to us in the form of noun phrases. However, expanding the database changes the output we receive in Question1. Do we reflect all changes everywhere, all the time, and retest queries from previous questions whenever the database is updated, OR, is it okay, to treat each question separately?
A3
The best approach to take is to submit the Prolog queries/answers that you are getting from the final version of your database. This is to make sure that your answers will be same as answers that TA will get when testing your database.

Q4
When testing some queries, that have only 1 or 2 unique solutions, prolog outputs same lines, with repititions. Is it due to an error in our program or not?
A4
It's ok, if you get same answer a few times, as long as you eventually get all correct answers according to what is known in your KB. Repetition is not an error, but this is just due to backtracking that goes through your program and retrieves same value from your KB again and again. In this assignment, do not try to optimize your program to make sure that it will generate each correct answer once only. In our course, we do not actually study advanced Prolog programming techniques that can be used to cut useless backtracking steps.

Q5
Concerning the article "the", is this a bonus question?
A5
No, this is a regular part of a your assignment, but it is recommended to start handling the only after completing the other parts of your assignment. Please note that you have to implement the so that it works with any database (including TA's database that can be different from yours). Also, the TA can submit arbitrary noun phrases to test your program, and your program should be able to handle them correctly as long as words are included in the required vocabulary. Consequently, think carefully how you can modularize your program to satisfy all these requirements.

Q6
My problem is this: if I define the preposition "of" as of(X,Y):-brother(X,Y). of(X,Y):- friend(X,Y) then this preposition has no history to know that you are actually looking for <... skip ...>. Is this acceptable situation or no?
A6
You should not be writing anything like
    of(X,Y):-brother(X,Y). of(X,Y):- friend(X,Y)
This makes no sense. For program design ideas, look in the example discussed in class how you are supposed to characterize prepositions like of, with, from in the Lexicon part of your program. Notice that there are binary predicates in the database that serve to define meaning of prepositions, but each prepositions in the lexicon should be characterized using the predicate "preposition". If you do not see how prepositions work, implement first the noun phrases with articles, nouns and adjectives only. Once you have this simplified part of your program working, only then add prepositions. In any case, follow as closely as possible the example from class. Study how Lexicon is implemented.
To answer queries with prepositions correctly, implement your Lexicon carefully. Consider as an example, the noun phrase [a,friend,from,toronto,of,a,single,man,from,ottawa]. Note that in Lexicon, you should have a rule that relates a common noun "friend" to the predicate "person" from your database. Also, you should have a rule that relates in the lexicon a preposition "of" to the predicate "friend" in your database because this is how we use "of" in the noun phrase above: "a friend (X) of Y" should mean  friend(X,Y) in your database, where each of X,Y is a person. Notice you have to include several rules for preposition "of" in the lexicon to handle other noun phrases like "a sister (=X) of Y" (this phrase should mean sister(X,Y) in your KB), or "a wife [denoted by X] of Y" (should mean wife(X,Y) in your KB), and so on. As you see, I assume that you already have rules in your KB that define predicates sister(X,Y), wife(X,Y), and so on. In class, we discussed that a preposition "with" is ambiguous and can be interpreted using several different binary predicates (see the example about parks and people). Similarly, a preposition "of" is ambiguous and may be interpreted using several different binary predicates.

Q7
For implementing the article "the", it appears to me that we will have to change the parser, is this correct?
A7
Yes, you can modify your parser slightly to handle "the" correctly. This is the only case when you are allowed to modify the parser given to you.

Q8
I spoke to you in class and asked about many (about 10) repetitions of a person name in answers to some of my queries.
A8
Yes, as explained above in Q4/A4, repetitions of a correct answer are ok, but make sure you will never get wrong answers. The TA can use his own database for testing, so his answers to queries can be different from you.

Q9
I am a little confused about how "person" and "male"/"female" relate to each other. Is it not safe to assume that "person" is simply the union of "male" and "female"? And if so, why do we need separate facts for "person" in the database, instead of 2 rules defining "person" in terms of "male" and "female"?
A9
There is no need to write separately atomic facts for "person" in the database. You are right that 2 rules defining "person" in terms of the predicates "male" and "female" are sufficient for the purposes of this assignment.

Q10

A10

Q11

A11

 

 


CPS721