示例#1
0
    def __init__(self, **property_names):
        PropertyIndirectionMixIn.__init__(self, **property_names)

        # A token reader for processing sentences.
        self._sent_reader = ChunkedTaggedTokenReader(top_node='S',
                                                     chunk_node='NP',
                                                     **property_names)
示例#2
0
from nltk.tokenreader.tagged import ChunkedTaggedTokenReader
chunked_string = "[ the/DT little/JJ cat/NN ] sat/VBD on/IN [ the/DT mat/NN ]"
reader = ChunkedTaggedTokenReader(chunk_node='NP', SUBTOKENS='WORDS')
sent_token = reader.read_token(chunked_string)
print sent_token['TREE']