Brill tagging (5.6)

Brill tagging concept is shown in the textbook. This is an example in NLTK.

>>> nltk.tag.brill.demo()
Loading tagged data... 
Done loading.
Training unigram tagger:
    [accuracy: 0.832151]
Training bigram tagger:
    [accuracy: 0.837930]
Training Brill tagger on 1600 sentences...
Finding initial useful rules...
    Found 9757 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
------------------+-------------------------------------------------------
  11  15   4   0  | WDT -> IN if the tag of words i+1...i+2 is 'DT'
  10  12   2   0  | IN -> RB if the text of the following word is
                  |   'well'
   9   9   0   0  | WDT -> IN if the tag of the preceding word is
                  |   'NN', and the tag of the following word is 'NNP'
   7   9   2   0  | RBR -> JJR if the tag of words i+1...i+2 is 'NNS'
   7  10   3   0  | WDT -> IN if the tag of words i+1...i+2 is 'NNS'
   5   5   0   0  | WDT -> IN if the tag of the preceding word is
                  |   'NN', and the tag of the following word is 'PRP'
   4   4   0   1  | WDT -> IN if the tag of words i+1...i+3 is 'VBG'
   3   3   0   0  | RB -> IN if the tag of the preceding word is 'NN',
                  |   and the tag of the following word is 'DT'
   3   3   0   0  | RBR -> JJR if the tag of the following word is
                  |   'NN'
   3   3   0   0  | VBP -> VB if the tag of words i-3...i-1 is 'MD'
   3   3   0   0  | NNS -> NN if the text of the preceding word is
                  |   'one'
   3   3   0   0  | RP -> RB if the text of words i-3...i-1 is 'were'
   3   3   0   0  | VBP -> VB if the text of words i-2...i-1 is "n't"

Brill accuracy: 0.839156
Done; rules and errors saved to rules.yaml and errors.out.
>>> 

This is the error log.

>>> print(open("errors.out").read())
Errors for Brill Tagger 'rules.yaml'

             left context |    word/test->gold     | right context
--------------------------+------------------------+--------------------------
 Chairman/NNP Richard/NNP |    Breeden/NN->NNP     | has/VBZ said/VBD 0/-NONE-
TO consider/VB circuit/NN |    breakers/NN->NNS    | that/WDT *T*-215/-NONE- h
/NN breakers/NNS that/WDT |   *T*-215/NN->-NONE-   | have/VBP preset/JJ trigge
T *T*-215/-NONE- have/VBP |     preset/NN->JJ      | trigger/NN points/NNS ,/,
n/NNP was/VBD so/RB ``/`` |      vague/NN->JJ      | and/CC mushy/JJ ''/'' tha
/RB ``/`` vague/JJ and/CC |      mushy/NN->JJ      | ''/'' that/IN it/PRP was/
....
gton/NNP ,/, D.C./NNP ,/, |       as/IN->RB        | long/RB as/IN they/PRP co
NP ,/, D.C./NNP ,/, as/RB |      long/JJ->RB       | as/IN they/PRP could/MD i
B as/IN they/PRP could/MD |     install/NN->VB     | a/DT crash/JJ barrier/NN 
 could/MD install/VB a/DT |      crash/NN->JJ      | barrier/NN between/IN the
                          |      Tray/NN->NNP      | Bon/NNP ?/.
                 Tray/NNP |      Bon/NN->NNP       | ?/.
      Drink/NN Carrier/NN |    Competes/NN->VBZ    | With/IN Cartons/NNS
r/NN Competes/VBZ With/IN |    Cartons/NN->NNS     | 
                 */-NONE- |    PORTING/NN->VBG     | POTABLES/NNS just/RB got/
     */-NONE- PORTING/VBG |    POTABLES/NN->NNS    | just/RB got/VBD easier/JJ
/, or/CC so/RB claims/VBZ |    Scypher/NN->NNP     | Corp./NNP ,/, the/DT make
/DT maker/NN of/IN the/DT |    Cup-Tote/NN->NNP    | ./.

>>> 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s