Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can u figure out this Q

Status
Not open for further replies.

ahhhhhhhhhhhhhhhh

Programmer
Feb 16, 2004
1
GB
Assume the lexicon below or some suitable variant of it. The arguments of lexicon/3 represent the word form, the word category and a list of selectional properties. The selectional properties determine with which categories a word must combine and in what order. For instance, the verb bought must combine with something of category d on its right and subsequently with something of category d on its left


THE LEXICON

lexicon(slept,v,[d-l]).

lexicon(bought,v,[d-r,d-l]).

lexicon(saw,v,[d-r,d-l]).

lexicon(said,v,[v-r,d-l]).

lexicon(gave,v,[d-r,d-r,d-l]).

lexicon(told,v,[d-r,v-r,d-l]).

lexicon(wanted,v,[d-r,d-l]).

lexicon(the,d,[n-r]).

lexicon(a,d,[n-r]).

lexicon(book,n,[]).

lexicon(books,d,[]).

lexicon(table,n,[]).

lexicon(man,n,[]).

lexicon(men,d,[]).

lexicon(john,d,[]).

lexicon(mary,d,[]).

lexicon(bill,d,[]).

lexicon(sue,d,[]).

lexicon(about,p,[d-r]).

lexicon(on,p,[d-r]).

lexicon(of,p,[d-r]).

lexicon(in,p,[d-r]).

lexicon(with,p,[d-r]).



THE EXERCISE


You must write a predicate parse with at least the following arguments

A list of words.

A value that determines whether selection is on or off.

A value that determines, in cases where selection is on, whether directionality is on or off.



The parser:
is able to report the number of distinct trees it has found for a parse with a given setting of the parameters selection and directionality. Please note that the number of trees that can be found when selection is 'off' grows very rapidly with the length of the input string.

is able to detect, when selection is set to 'on', whether the selectional requirements of a word have not been met (e.g. John bought) or have been met more than once (e.g. John bought books books). Hence, it does not give output for such strings when selection is 'on' (although it will do when selection is 'off').

includes a suitable interface that interacts with the user in appropriate ways. This interface should fail gracefully. That is, a failed parse may not cause the interface to fail. The interface should only exit when the user chooses to exit it.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top