Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Rebuild Brown Corpus tags and rerun tagger evaluations. If you train on treebank it should be fairly accurate when you test on brown. import nltk.tag

Rebuild Brown Corpus tags and rerun tagger evaluations. If you train on treebank it should be fairly accurate when you test on brown.

image text in transcribed

import nltk.tag as tag word-patterns [ (r'^-2 [0-9]+(. [0-9]+)25', (r ' (The l the l Ala l An I an) $ ' ' 'CD'), ' AT ' ) , # cardinal numbers # articles # adjectives # nouns formed from adjectives # adverbs # plural nouns # gerunds (r'.*ing$ ' , 'VBG ' ), past tense verbs nouns (default) # From the NLTK3 cookbook tag-util.py file def backoff tagger (train sents, taqger classes, backoff-None): for cls in tagger classes: backoff cls (train_sents, backoff-backoff) return backoff inner taggerbackoff tagger (brown train, [tag.AffixTagger, tag.UnigramTagger, Cag Bigramlagger tag.TrigramTagger], backoff-tag.RegexpTagger (word_patterns) ) brill_trainer tag.BrillTaggerTrainer (inner_tagger, tag.brill.bril124 )) brill tagger = brill trainer.train (brown train, max rules=400, min sc re=3) print (brill_tagger.evaluate (treebank_test)) print (brill_tagger.evaluate (brown test)) print (brill tagger.evaluate (conll test)) 0.582085042089359 0.9284236339949421 0.6032014228546021 import nltk.tag as tag word-patterns [ (r'^-2 [0-9]+(. [0-9]+)25', (r ' (The l the l Ala l An I an) $ ' ' 'CD'), ' AT ' ) , # cardinal numbers # articles # adjectives # nouns formed from adjectives # adverbs # plural nouns # gerunds (r'.*ing$ ' , 'VBG ' ), past tense verbs nouns (default) # From the NLTK3 cookbook tag-util.py file def backoff tagger (train sents, taqger classes, backoff-None): for cls in tagger classes: backoff cls (train_sents, backoff-backoff) return backoff inner taggerbackoff tagger (brown train, [tag.AffixTagger, tag.UnigramTagger, Cag Bigramlagger tag.TrigramTagger], backoff-tag.RegexpTagger (word_patterns) ) brill_trainer tag.BrillTaggerTrainer (inner_tagger, tag.brill.bril124 )) brill tagger = brill trainer.train (brown train, max rules=400, min sc re=3) print (brill_tagger.evaluate (treebank_test)) print (brill_tagger.evaluate (brown test)) print (brill tagger.evaluate (conll test)) 0.582085042089359 0.9284236339949421 0.6032014228546021

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Creating A Database In Filemaker Pro Visual QuickProject Guide

Authors: Steven A. Schwartz

1st Edition

0321321219, 978-0321321213

More Books

Students also viewed these Databases questions

Question

Discuss chaos theory and the concept of the learning organization.

Answered: 1 week ago