foundations of computational agents
There is nothing in the definition of the grammar that requires English input and the parse tree as output. A query of the grammar rules with the meaning of the sentence bound and a free variable representing the sentence can produce a sentence that matches the meaning.
One such use of grammar rules is to provide canned text output from logic terms; the output is a sentence in English that matches the logic term. This is useful for producing English versions of atoms, rules, and questions that a user – who may not know the intended interpretation of the symbols, or even the syntax of the formal language – can more easily understand.
% is true if translates into the words contained in the difference list .
Figure 13.9 shows a grammar for producing canned text on schedule information. The query
produces the answer the, winter, 2021, session, of, the, advanced, artificial, intelligence, course, is, scheduled, at, 3, :, 30, pm, in, the, room, above, the, computer, science, department, office. This list could be rewritten as a sentence to the user.
This code used the Prolog infix predicate “is”, where “ is ” is true when expression evaluates to number , and the binary relations and .
This grammar would probably not be useful for understanding natural language, because it requires a very stylized form of English; the user would have to use the exact translation of a term to get a legal parse.