__init__(self,
n,
train=None,
model=None,
backoff=None,
cutoff=0,
verbose=False)
(Constructor)
| source code
|
Train a new NgramTagger using the given training data or
the supplied model. In particular, construct a new tagger whose table
maps from each context (tag[i-n:i-1], word[i]) to the most
frequent tag for that context. But exclude any contexts that are already
tagged perfectly by the backoff tagger.
- Parameters:
train - A tagged corpus consisting of a list of tagged
sentences, where each sentence is a list of
(word, tag) tuples.
backoff - A backoff tagger, to be used by the new tagger if it encounters
an unknown context.
cutoff - If the most likely tag for a context occurs fewer than
cutoff times, then exclude it from the
context-to-tag table for the new tagger.
- Overrides:
SequentialBackoffTagger.__init__
|