/* File: chom1.pl Author: Mihaela Malita Title: A grammar to build sentences in English Plural/Singular Our vocabulary consists of: 3 nouns: boy , girl , dog and 3 verbs: likes , hates , loves Plural(pl) versus Singular (sg) the boy like the dog incorrect the boy likes the dog correct We have to put the condition that the number of the noun has to be the same as the number of the verb. ?-phrase(sentence(N),[the,boy,likes,the,dog]). N = sg ?- phrase(sentence(pl),X). [the,boys,like,the,dogs] .. ?- phrase(sentence(I),[the,boys,likes,the,dog]). no ?- phrase(sentence(N),[the,boy,likes,the,dogs]). N = sg Yes */ sentence(Nr) --> noun_ph(Nr),verb_ph(Nr). noun_ph(Nr) --> det(Nr),noun(Nr). verb_ph(Nr) --> verb(Nr),noun_ph(_). det(_) --> [the]. % determiner noun(sg) --> [boy]; [dog]; [girl]. noun(pl) --> [boys]; [dogs]; [girls]. verb(sg) --> [likes] ; [hates] ; [loves]. verb(pl) --> [like]; [hate]; [love].