nltk.tag.AffixTagger

class nltk.tag.AffixTagger(train=None, model=None, affix_length=-3, min_stem_length=2, backoff=None, cutoff=0, verbose=False)[source]

A tagger that chooses a token’s tag based on a leading or trailing substring of its word string. (It is important to note that these substrings are not necessarily “true” morphological affixes). In particular, a fixed-length substring of the word is looked up in a table, and the corresponding tag is returned. Affix taggers are typically constructed by training them on a tagged corpus.

Construct a new affix tagger.

Parameters:
  • affix_length – The length of the affixes that should be considered during training and tagging. Use negative numbers for suffixes.
  • min_stem_length – Any words whose length is less than min_stem_length+abs(affix_length) will be assigned a tag of None by this tagger.

Methods

__init__([train, model, affix_length, ...])
choose_tag(tokens, index, history)
context(tokens, index, history)
decode_json_obj(obj)
encode_json_obj()
evaluate(gold) Score the accuracy of the tagger against the gold standard.
size()
return:The number of entries in the table used by this
tag(tokens)
tag_one(tokens, index, history) Determine an appropriate tag for the specified token, and return that tag.
tag_sents(sentences) Apply self.tag() to each element of sentences.
unicode_repr()

Attributes

backoff The backoff tagger for this tagger.
json_tag