Package nltk :: Package classify :: Module api :: Class ClassifierI
[hide private]
[frames] | no frames]

Class ClassifierI

source code

object --+
         |
        ClassifierI
Known Subclasses:

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

Subclasses must define:

Subclasses may define:

Instance Methods [hide private]
list of (immutable)
labels(self)
Returns: the list of category labels used by this classifier.
source code
label
classify(self, featureset)
Returns: the most appropriate label for the given featureset.
source code
ProbDistI
prob_classify(self, featureset)
Returns: a probability distribution over labels for the given featureset.
source code
list of label
batch_classify(self, featuresets)
Apply self.classify() to each element of featuresets.
source code
list of ProbDistI
batch_prob_classify(self, featuresets)
Apply self.prob_classify() to each element of featuresets.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

    Deprecated
 
batch_probdist(*args, **kwargs) source code
 
probdist(*args, **kwargs) source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

labels(self)

source code 
Returns: list of (immutable)
the list of category labels used by this classifier.

classify(self, featureset)

source code 
Returns: label
the most appropriate label for the given featureset.

prob_classify(self, featureset)

source code 
Returns: ProbDistI
a probability distribution over labels for the given featureset.

batch_classify(self, featuresets)

source code 

Apply self.classify() to each element of featuresets. I.e.:

>>> return [self.classify(fs) for fs in featuresets]
Returns: list of label

batch_prob_classify(self, featuresets)

source code 

Apply self.prob_classify() to each element of featuresets. I.e.:

>>> return [self.prob_classify(fs) for fs in featuresets]
Returns: list of ProbDistI

batch_probdist(*args, **kwargs)

source code 
Decorators:
  • @deprecated("Use .batch_prob_classify() instead.")

Deprecated: Use .batch_prob_classify() instead.

probdist(*args, **kwargs)

source code 
Decorators:
  • @deprecated("Use .prob_classify() instead.")

Deprecated: Use .prob_classify() instead.