13.6 Applications in Natural Language

13.6.3 Building Structures for Non-terminals

You can add an extra argument to the predicates to represent a parse tree, forming a rule such as

sentence(L0,L2,s(NP,VP))
    noun_phrase(L0,L1,NP)
    verb_phrase(L1,L2,VP).

which means that the parse tree for a sentence is of the form s(NP,VP), where NP is the parse tree for the noun phrase and VP is the parse tree for the verb phrase.

This is important if you want some result from the syntactic analysis, not just to know whether the sentence is syntactically valid. The notion of a parse tree is a simplistic form of what is required because it does not adequately represent the meaning or the deep structure of a sentence. For example, you would really like to recognize that “Sam taught the AI course” and “the AI course was taught by Sam” have the same meaning, only differing in the active or passive voice.