question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Brill Tagger Demo Broken

See original GitHub issue

I noticed that in the book (section 6, example 6.1), the suggested code is: nltk.tag.brill.demo()

When I run this I get the following error: AttributeError: module 'nltk.tag.brill' has no attribute 'demo'

Am I missing something?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

9reactions
antmarakiscommented, Sep 13, 2017

What @campionfellin did worked. Thanks!

Maybe the book should instead of nltk.tag.brill.demo() be:

from nltk.tbl import demo as brill_tagger
brill_tagger.demo()
4reactions
campionfellincommented, Sep 13, 2017

Hey, I am not getting this error, using python v2.7.10. What version are you using? This is my output:

>>> import nltk
>>> from nltk.tbl import demo as issue1828
>>> issue1828.demo()
Loading tagged data from treebank...
Read testing data (200 sents/5251 wds)
Read training data (800 sents/19933 wds)
Read baseline data (800 sents/19933 wds) [reused the training set]
Trained baseline tagger
    Accuracy on test set: 0.8345
Training tbl tagger...
TBL train (fast) (seqs: 800; tokens: 19933; tpls: 24; min score: 3; min acc: None)
Finding initial useful rules...
    Found 12960 useful rules.

           B      |
   S   F   r   O  |        Score = Fixed - Broken
   c   i   o   t  |  R     Fixed = num tags changed incorrect -> correct
   o   x   k   h  |  u     Broken = num tags changed correct -> incorrect
   r   e   e   e  |  l     Other = num tags changed incorrect -> incorrect
   e   d   n   r  |  e
------------------+-------------------------------------------------------
  23  23   0   0  | POS->VBZ if Pos:PRP@[-2,-1]
  16  17   1   0  | NN->VB if Pos:-NONE-@[-2] & Pos:TO@[-1]
  15  16   1   0  | VBN->VBD if Pos:PRP@[-1]
  12  12   0   0  | VBP->VB if Pos:MD@[-2,-1]

and so on…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Brill tagger - Wikipedia
The Brill tagger is an inductive method for part-of-speech tagging. It was described and invented by Eric Brill in his 1993 PhD thesis....
Read more >
NLP | Brill Tagger - GeeksforGeeks
BrillTagger class is a transformation-based tagger. It is not a subclass of SequentialBackoffTagger. Moreover, it uses a series of rules to ...
Read more >
Example 6.1 (code_brill_demo.py) - NLTK
... import demo as brill_demo >>> brill_demo.demo() Training Brill tagger on ... changed incorrect -> correct o x k...
Read more >
What is a brill tagger in nltk - ProjectPro
Let us first import the necessary libraries. We'll import brill, brill_trainer, DefaultTagger and treebank from nltk.tag and nltk.corpus ...
Read more >
Natural Language Processing Module
Brill's tagger is one of the best rule-based tagging systems. ... For example, the word rat can be assigned the tag NN (noun,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found