class documentation

A tagger that assigns the same tag to every token.

>>> from nltk.tag import DefaultTagger
>>> default_tagger = DefaultTagger('NN')
>>> list(default_tagger.tag('This is a test'.split()))
[('This', 'NN'), ('is', 'NN'), ('a', 'NN'), ('test', 'NN')]

This tagger is recommended as a backoff tagger, in cases where a more powerful tagger is unable to assign a tag to the word (e.g. because the word was not seen during training).

Parameters
tagThe tag to assign to each token
Class Method decode_json_obj Undocumented
Method __init__ Undocumented
Method __repr__ Undocumented
Method choose_tag 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 encode_json_obj Undocumented
Class Variable json_tag Undocumented
Instance Variable _tag Undocumented

Inherited from SequentialBackoffTagger:

Method tag_one 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 (via SequentialBackoffTagger):

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_sents Apply self.tag() to each element of sentences. I.e.:
Method _check_params Undocumented
@classmethod
def decode_json_obj(cls, obj): (source)

Undocumented

def __init__(self, tag): (source)
def __repr__(self): (source)

Undocumented

def choose_tag(self, tokens, index, history): (source)

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:listThe list of words that are being tagged.
index:intThe index of the word whose tag should be returned.
history:list(str)A list of the tags for all words before index.
Returns
strUndocumented
def encode_json_obj(self): (source)

Undocumented

json_tag: str = (source)

Undocumented

Undocumented