foundations of computational agents
The third edition of Artificial Intelligence: foundations of computational agents, Cambridge University Press, 2023 is now available (including full text).
Natural language imposes constraints which, for example, disallow sentences such as “A students eat.” Words in a sentence must satisfy some agreement criteria. “A students eat.” fails to satisfy the criterion of number agreement, which specifies whether the nouns and verbs are singular or plural.
Number agreement can be enforced in the grammar by parametrizing the non-terminals by the number and making sure that the numbers of the different parts of speech agree. You only need to add an extra argument to the relevant non-terminals.
% A sentence is a noun phrase followed by a verb phrase.
% A noun phrase is empty or a determiner followed by adjectives followed by a noun followed by an optional prepositional phrase.
% A verb phrase is a verb, followed by a noun phrase, followed by an optional prepositional phrase.
% An optional prepositional phrase is either nothing or a preposition followed by a noun phrase. Only the null case is given here.
% Adjectives is a sequence of adjectives. Only the null case is given here.
% The dictionary.
The grammar of Figure 13.10 does not allow “a students,” “the student eat,” or “the students eats,” because all have number disagreement, but it allows “a green student eats,” “the students,” or “the student,” because “the” can be either singular or plural.
To parse the sentence “the student eats,” you issue the query
and the answer returned is
To parse the sentence “the students eat,” you issue the query
and the answer returned is
To parse the sentence “a student eats,” you issue the query
and the answer returned is
Note that the only difference between the answers is whether the subject is singular and whether the determiner is definite.