class SequentialBackoffTagger(TaggerI): (source)
Known subclasses: nltk.tag.sequential.ClassifierBasedTagger, nltk.tag.sequential.ContextTagger, nltk.tag.sequential.DefaultTagger, nltk.tag.sequential.RegexpTagger
Constructor: SequentialBackoffTagger(backoff)
An abstract base class for taggers that tags words sequentially, left to right. Tagging of individual words is performed by the choose_tag() method, which should be defined by subclasses. If a tagger is unable to determine a tag for the specified token, then its backoff tagger is consulted.
| Method | __init__ |
Undocumented |
| Method | choose |
Decide which tag should be used for the specified token, and return that tag. If this tagger is unable to determine a tag for the specified token, return None -- do not consult the backoff tagger. This method should be overridden by subclasses of SequentialBackoffTagger. |
| Method | tag |
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). |
| Method | tag |
Determine an appropriate tag for the specified token, and return that tag. If this tagger is unable to determine a tag for the specified token, then its backoff tagger is consulted. |
| Property | backoff |
The backoff tagger for this tagger. |
| Instance Variable | _taggers |
A list of all the taggers that should be tried to tag a token (i.e., self and its backoff taggers). |
Inherited from TaggerI:
| Method | evaluate |
Score the accuracy of the tagger against the gold standard. Strip the tags from the gold standard text, retag it using the tagger, then compute the accuracy score. |
| Method | tag |
Apply self.tag() to each element of sentences. I.e.: |
| Method | _check |
Undocumented |
nltk.tag.sequential.ClassifierBasedTagger, nltk.tag.sequential.ContextTagger, nltk.tag.sequential.DefaultTagger, nltk.tag.sequential.RegexpTaggerDecide which tag should be used for the specified token, and return that tag. If this tagger is unable to determine a tag for the specified token, return None -- do not consult the backoff tagger. This method should be overridden by subclasses of SequentialBackoffTagger.
| Parameters | |
| tokens:list | The list of words that are being tagged. |
| index:int | The index of the word whose tag should be returned. |
| history:list(str) | A list of the tags for all words before index. |
| Returns | |
| str | Undocumented |
nltk.tag.api.TaggerI.tagnltk.tag.sequential.DefaultTaggerDetermine 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(tuple(str, str)) | Undocumented |
Determine an appropriate tag for the specified token, and return that tag. If this tagger is unable to determine a tag for the specified token, then its backoff tagger is consulted.
| Parameters | |
| tokens:list | The list of words that are being tagged. |
| index:int | The index of the word whose tag should be returned. |
| history:list(str) | A list of the tags for all words before index. |
| Returns | |
| str | Undocumented |
nltk.tag.sequential.BigramTagger, nltk.tag.sequential.TrigramTagger, nltk.tag.sequential.UnigramTaggerThe backoff tagger for this tagger.