Skip to content

Instantly share code, notes, and snippets.

@alexbowe alexbowe/
Created Sep 12, 2010

What would you like to do?
# Extracting nounphrase chunks from a parse tree
# from
# for each noun phrase sub tree in the parse tree
for subtree in tree.subtrees(filter=lambda t: t.node == 'NP'):
# print the noun phrase as a list of part-of-speech tagged words
print subtree.leaves()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.