November 2016
Beginner to intermediate
687 pages
15h 31m
English
The drawback of Recursive Descent Parsing is that it causes the Left Recursion Problem and is very complex. So, CYK chart parsing was introduced. It uses the Dynamic Programming approach. CYK is one of the simplest chart parsing algorithms. The CYK algorithm is capable of constructing a chart in O(n3) time. Both CYK and Earley are Bottom-up chart parsing algorithms. But, the Earley algorithm also makes use of Top-down predictions when invalid parses are constructed.
Consider the following example of CYK parsing:
tok = ["the", "kids", "opened", "the", "box", "on", "the", "floor"] gram = nltk.parse_cfg(""" S -> NP VP NP -> Det N | NP PP VP -> V NP | VP PP PP -> P NP Det -> 'the' N -> 'kids' | 'box' | 'floor' V -> 'opened' ...Read now
Unlock full access