Package nltk :: Package tag :: Class Ngram
[hide private]
[frames] | no frames]

Class Ngram

source code

                    object --+        
                             |        
                   api.TaggerI --+    
                                 |    
sequential.SequentialBackoffTagger --+
                                     |
                        object --+   |
                                 |   |
              internals.Deprecated --+
                                     |
                                    Ngram
Known Subclasses:

Use nltk.NgramTagger instead. Note: NgramTagger.train() is now a factory method.

Instance Methods [hide private]
 
__init__(self, n, cutoff=1, backoff=None) source code
 
train(self, tagged_corpus, verbose=False) source code
str
choose_tag(self, tokens, index, history)
Decide which tag should be used for the specified token, and return that tag.
source code

Inherited from sequential.SequentialBackoffTagger: tag, tag_one

Inherited from api.TaggerI: batch_tag

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

    Deprecated

Inherited from sequential.SequentialBackoffTagger: tag_sents

Static Methods [hide private]

Inherited from internals.Deprecated: __new__

Instance Variables [hide private]

Inherited from sequential.SequentialBackoffTagger (private): _taggers

Properties [hide private]

Inherited from sequential.SequentialBackoffTagger: backoff

Inherited from object: __class__

Method Details [hide private]

__init__(self, n, cutoff=1, backoff=None)
(Constructor)

source code 
Overrides: sequential.SequentialBackoffTagger.__init__

choose_tag(self, tokens, index, history)

source code 

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.

Parameters:
  • tokens - The list of words that are being tagged.
  • index - The index of the word whose tag should be returned.
  • history - A list of the tags for all words before index.
Returns: str
Overrides: sequential.SequentialBackoffTagger.choose_tag
(inherited documentation)