If I could have one follow-up for now.
Can you help me understand how parse() works in the following function from the NLTK cookbook? I don't see it being utilized anywhere...I've tried print statements, but nothing returns.
class ClassifierChunker(nltk.chunk.ChunkParserI):
def __init__(self, train_sents, feature_detector=prev_next_pos_iob,
**kwargs):
#Self just refers to the class object itself..
#train_sents = train_chunks (the initial input)
#Prev_next_pos_iob = a function defined above to find features
if not feature_detector:
feature_detector = self.feature_detector
#now all train_sents is transformed into tuple form (N, POS), IOB
train_chunks = chunk_trees2train_chunks(train_sents)
#input feature directly into ClassifierBasedTagger, which is a
#sequential classifier taking info of previous POS and word
self.tagger = ClassifierBasedTagger(train=train_chunks,
feature_detector=feature_detector, **kwargs)
def parse(self, tagged_sent):
"""
As a subclass of ChunkerParserI,
it implements the parse() method, which converts the ((w, t), c)
tuples produced by the internal tagger into a Tree
using nltk.chunk.conlltags2tree().