Package nltk :: Package tag :: Module sequential :: Class AffixTagger
[hide private]
[frames] | no frames]

Class AffixTagger

source code

         object --+            
                  |            
        api.TaggerI --+        
                      |        
SequentialBackoffTagger --+    
                          |    
              ContextTagger --+
                              |
                 object --+   |
                          |   |
            yaml.YAMLObject --+
                              |
                             AffixTagger

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; see the constructor.

Nested Classes [hide private]

Inherited from yaml.YAMLObject: __metaclass__, yaml_dumper, yaml_loader

Instance Methods [hide private]
 
__init__(self, train=None, model=None, affix_length=-3, min_stem_length=2, backoff=None, cutoff=1, verbose=False)
Construct a new affix tagger.
source code
(hashable)
context(self, tokens, index, history)
Returns: the context that should be used to look up the tag for the specified token; or None if the specified token should not be handled by this tagger.
source code

Inherited from ContextTagger: __repr__, choose_tag, size

Inherited from ContextTagger (private): _train

Inherited from SequentialBackoffTagger: tag, tag_one

Inherited from SequentialBackoffTagger (private): _get_backoff

Inherited from api.TaggerI: batch_tag

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

    Deprecated

Inherited from SequentialBackoffTagger: tag_sents

Class Methods [hide private]

Inherited from yaml.YAMLObject: from_yaml, to_yaml

Class Variables [hide private]
  yaml_tag = '!nltk.AffixTagger'

Inherited from yaml.YAMLObject: yaml_flow_style

Instance Variables [hide private]

Inherited from ContextTagger (private): _context_to_tag

Inherited from SequentialBackoffTagger (private): _taggers

Properties [hide private]

Inherited from SequentialBackoffTagger: backoff

Inherited from object: __class__

Method Details [hide private]

__init__(self, train=None, model=None, affix_length=-3, min_stem_length=2, backoff=None, cutoff=1, verbose=False)
(Constructor)

source code 

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.
Overrides: ContextTagger.__init__

context(self, tokens, index, history)

source code 
Returns: (hashable)
the context that should be used to look up the tag for the specified token; or None if the specified token should not be handled by this tagger.
Overrides: ContextTagger.context
(inherited documentation)