nltk.TaggerI

class nltk.TaggerI[source]

A processing interface for assigning a tag to each token in a list. Tags are case sensitive strings that identify some property of each token, such as its part of speech or its sense.

Some taggers require specific types for their tokens. This is generally indicated by the use of a sub-interface to TaggerI. For example, featureset taggers, which are subclassed from FeaturesetTagger, require that each token be a featureset.

Subclasses must define:
  • either tag() or tag_sents() (or both)

Methods

evaluate(gold) Score the accuracy of the tagger against the gold standard.
tag(tokens) Determine the most appropriate tag sequence for the given token sequence, and return a corresponding list of tagged tokens.
tag_sents(sentences) Apply self.tag() to each element of sentences.