Question
Create a DCG that has the following features: 1. handle subject/object distinction 2. singular/plural distinction 3. capable of producing parse trees 4. make use of
Create a DCG that has the following features:
1. handle subject/object distinction
2. singular/plural distinction
3. capable of producing parse trees
4. make use of a separate lexicon (as shown in the starter code).
Note: Do not change the lexicon in any way. This could cause the test cases to fail.
As an example the following is the Prolog parse tree for the query
"?- s(X,[the, man, eats, the, apple],[]).":
X = s(np(det(the, singular), n(man, singular, subject)), vp(v(eats, singular), np(det(the, singular), n(apple, singular, object)))).
lex(the,det,_). lex(a,det,singular).
lex(man,n,singular). lex(men,n,plural). lex(woman,n,singular). lex(women,n,plural). lex(apple,n,singular). lex(apples,n,plural). lex(pear,n,singular). lex(pears,n,plural).
lex(eat,v,plural). lex(eats,v,singular). lex(know,v,plural). lex(knows,v,singular).
lex(i,pronoun,singular,subject). lex(we,pronoun,plural,subject). lex(me,pronoun,singular,object). lex(us,pronoun,plural,object). lex(you,pronoun,_,_). lex(he,pronoun,singular,subject). lex(she,pronoun,singular,subject). lex(him,pronoun,singular,object). lex(her,pronoun,singular,object). lex(they,pronoun,plural,subject). lex(them,pronoun,plural,object). lex(it,pronoun,singular,_).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started