Package nltk :: Package tag :: Module api :: Class TaggerI
[hide private]
[frames] | no frames]

Class TaggerI

source code

object --+
         |
        TaggerI
Known Subclasses:

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 FeaturesetTaggerI, require that each token be a featureset.

Subclasses must define:

Instance Methods [hide private]
list of (token, tag)
tag(self, tokens)
Determine the most appropriate tag sequence for the given token sequence, and return a corresponding list of tagged tokens.
source code
 
batch_tag(self, sentences)
Apply self.tag() to each element of sentences.
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

tag(self, tokens)

source code 

Determine the most appropriate tag sequence for the given token sequence, and return a corresponding list of tagged tokens. A tagged token is encoded as a tuple (token, tag).

Returns: list of (token, tag)

batch_tag(self, sentences)

source code 

Apply self.tag() to each element of sentences. I.e.:

>>> return [self.tag(tokens) for tokens in sentences]