Skip to content Skip to sidebar Skip to footer

Python NLTK Brill Tagger Does Not Have SymmetricProximateTokensTemplate, ProximateTokensTemplate, ProximateTagsRule, ProximateWordsRule

When i try importing, from nltk.tag.brill import SymmetricProximateTokensTemplate, ProximateTokensTemplate from nltk.tag.brill import ProximateTagsRule, ProximateWordsRule Pyth

Solution 1:

I'm using the templates from nltk.tag.brill.
There are four methods

  • nltkdemo18()
  • nltkdemo18plus()
  • fntbl37()
  • brill24()

which return sets of templates. From my evaluation fntbl37() is the best.

Here is some code:

Template._cleartemplates()
templates = fntbl37()
self._tagger = UnigramTagger(tagged_sents)
self._tagger = BrillTaggerTrainer(self._tagger, templates, trace=3)
self._tagger = self._tagger.train(tagged_sents, max_rules=250)

I hope it helps.


Solution 2:

The Brill part of NLTK has been redesigned in NLTK 3. So all those classes you try to import do not exist any more.
See https://github.com/nltk/nltk/pull/549

I'm looking for an example how to use the Brill Tagger but till now, I didn't find anything.


Post a Comment for "Python NLTK Brill Tagger Does Not Have SymmetricProximateTokensTemplate, ProximateTokensTemplate, ProximateTagsRule, ProximateWordsRule"