nltk.ClassifierI

class nltk.ClassifierI[source]

A processing interface for labeling tokens with a single category label (or “class”). Labels are typically strs or ints, but can be any immutable type. The set of labels that the classifier chooses from must be fixed and finite.

Subclasses must define:
  • labels()
  • either classify() or classify_many() (or both)
Subclasses may define:
  • either prob_classify() or prob_classify_many() (or both)

Methods

classify(featureset)
return:the most appropriate label for the given featureset.
classify_many(featuresets) Apply self.classify() to each element of featuresets.
labels()
return:the list of category labels used by this classifier.
prob_classify(featureset)
return:a probability distribution over labels for the given
prob_classify_many(featuresets) Apply self.prob_classify() to each element of featuresets.