# Natural Language Toolkit: cascaded_chunker
grammar = r"""
NP: {
+} # Chunk sequences of DT, JJ, NN
PP: {} # Chunk prepositions followed by NP
VP: {+$} # Chunk rightmost verbs and arguments/adjuncts
S: {} # Chunk NP, VP
"""
cp = nltk.RegexpParser(grammar)
tagged_tokens = [("Mary", "NN"), ("saw", "VBD"), ("the", "DT"), ("cat", "NN"),
("sit", "VB"), ("on", "IN"), ("the", "DT"), ("mat", "NN")]