part-of-speech

How do I retrieve phrases from a NLTK.tree using custom node labels?

How do I retrieve phrases from a NLTK.tree using custom node labels? Question: Given a NLTK tree produced using the code below, how do I retrieve the leaf values (phrases) that potentially match all of the node labels assigned using the nltk.RegexParser (e.g. those phrases which match the Present_Indefinite or Present_Perfect tense)? from nltk import …

Total answers: 1