Why We Build Trees
As we saw in Chapter 2, Basic Parsing Patterns, being able to recognize an input phrase means being able to identify and extract key input elements. For example, recognizing the English phrase “Rebecca runs to the park” means we know “Rebecca” is the subject, “runs” is the verb, and “to the park” is the object. Language recognition is more complicated than simply picking out the parts of speech, though. The order of those elements counts. In a modern English sentence, for example, the verb usually sits between the subject and the object. It sounds wrong (despite being intelligible) to say “Rebecca to the park runs.”[9]
Order is not the only important sentence recognition issue. Many languages have subphrases and nested structures. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access