![]() :param cutoff: If the most likely tag for a context occurs fewer than cutoff times, then exclude it from the context-to-tag table for the new tagger. Each item should be a list of (word, tag tuples. The old value of ``self._context_to_tag`` (if any) is discarded. However, exclude any contexts that are already tagged perfectly by the backoff tagger(s). In particular, for each context ``c`` in the training data, set ``_context_to_tag`` to the most frequent tag for that context. ![]() ![]() _context_to_tag ) def _repr_ ( self ): return f "" def _train ( self, tagged_corpus, cutoff = 0, verbose = False ): """ Initialize this ContextTagger's ``_context_to_tag`` table based on the given training data. def size ( self ): """ :return: The number of entries in the table used by this tagger to map from contexts to tags. """ import ast import re from abc import abstractmethod from typing import List, Optional, Tuple from nltk import jsontags from nltk.classify import NaiveBayesClassifier from nltk.probability import ConditionalFreqDist from import FeaturesetTaggerI, TaggerI # Abstract Base Classes # Any SequentialBackoffTagger may serve as a backoff tagger for any other SequentialBackoffTagger. If a tagger is unable to determine a tag for the specified token, then its backoff tagger is consulted instead. Tagging of individual words is performed by the method ``choose_tag()``, which is defined by subclasses of SequentialBackoffTagger. The abstract base class SequentialBackoffTagger serves as the base class for all the taggers in this module. # Natural Language Toolkit: Sequential Backoff Taggers # Copyright (C) 2001-2022 NLTK Project # Author: Edward Loper # Steven Bird (minor additions) # Tiago Tresoldi (original affix tagger) # URL: # For license information, see LICENSE.TXT """ Classes for tagging sentences sequentially, left to right.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |