Docsity

Transformation-Based Learning for Part-of-Speech Tagging - Prof. R. P. Malouf, Study notes of Linguistics

Partial preview of the text

Download Transformation-Based Learning for Part-of-Speech Tagging - Prof. R. P. Malouf and more Study notes Linguistics in PDF only on Docsity!

Homework

Read Jurafsky and Martin (1st or 2nd ed.), Chapter 5

Midterm [sic] exam

Out Friday, April 11

Due Friday, April 18

Open book, open notes, but work on it by yourself

  • Download and read^ fsa3.py^ as soon as possible!

Transformation-based learning is a non-statistical

technique for increasing the context

TBL starts with a baseline tagger and generates error-

correcting transformations (e.g., ‘replace VBD with NN

after AT’).

On each iteration, pick the rule with reduces the error

rate the most, and repeat until the error rate stops

improving.

Transformations can be conditioned on wider range of

contexts than n -grams without running into sparse data

problems

Transformation-based learning

Transformation-based learning

Rule templates

FT

Section 5.7. Evaluation and Error Analysis 153

transformation, in order to pick the best one on each pass through the algorithm. Thus

the algorithm needs a way to limit the set of transformations. This is done by designing

lates a small set of templates (abstracted transformations). Every allowable transformation

is an instantiation of one of the templates. Brill’s set of templates is listed in Fig. 5.20.

Fig. 5.21 gives the details of this algorithm for learning transformations.

The preceding (following) word is tagged z.

The word two before (after) is tagged z.

One of the two preceding (following) words is tagged z.

One of the three preceding (following) words is tagged z.

The preceding word is tagged z and the following word is tagged w.

The preceding (following) word is tagged z and the word

two before (after) is tagged w.

Figure 5.20 Brill’s (1995) templates. Each begins with “Change tag a to tag b when:... ”.
The variables a , b , z , and w range over parts-of-speech.

At the heart of Fig. 5.21 are the two functions GET BEST TRANSFORMATION

and GET BEST INSTANCE. GET BEST TRANSFORMATION is called with a list of

potential templates; for each template, it calls GET BEST INSTANCE. GET BEST -

INSTANCE iteratively tests every possible instantiation of each template by filling in

specific values for the tag variables a , b , z , and w.

In practice, there are a number of ways to make the algorithm more efficient. For

example, templates and instantiated transformations can be suggested in a data-driven

Transformation-based learning

Learning algorithm

T

154 Chapter 5. Part-of-Speech Tagging function TBL( corpus ) returns transforms-queue INTIALIZE-WITH-MOST-LIKELY-TAGS( corpus ) until end condition is met do templates ← GENERATE-POTENTIAL-RELEVANT-TEMPLATES best-transform ← GET-BEST-TRANSFORM( corpus , templates ) APPLY-TRANSFORM( best-transform , corpus ) ENQUEUE( best-transform-rule , transforms-queue ) end return ( transforms-queue ) function GET-BEST-TRANSFORM( corpus , templates ) returns transform for each template in templates ( instance , score ) ← GET-BEST-INSTANCE( corpus , template ) if ( score > best-transform.score ) then best-transform ← ( instance , score ) return ( best-transform ) function GET-BEST-INSTANCE( corpus , template) returns transform

Transformation-based learning

Learning algorithm

DRA best-Z ← ARGMAX t ( num-good-transforms (t) - num-bad-transforms if ( num-good-transforms ( best-Z ) - num-bad-transforms ( best-Z )

best-instance.score ) then

best.rule ← “Change tag from from-tag to to-tag if prev tag is b best.score ← num-good-transforms ( best-Z ) - num-bad-transform return ( best ) procedure APPLY-TRANSFORM( transform , corpus ) for pos ← from 1 to corpus-size do if ( current-tag ( pos )== best-rule-from ) && ( current-tag ( pos −1)== best-rule-prev )) current-tag ( pos ) ← best-rule-to Figure 5.21 The Brill (1995) TBL algorithm for learning to tag. GET BE have to change for transformation templates other than “Change tag from is Z”. we run it on the (hitherto unseen) test set to see its performance. of our data for training, and save 10% each for devtest and test. development test set distinct from the final test set? Because if w

Transformation-based learning

Results

Word accuracy is around 97%, which is very close to

the human ceiling

Final transforms queue can be compiled into a finite

state transducer, for efficient application

T Section 5.7. Evaluation and Error Analysis 155

Change tags
# From To Condition Example
1 NN VB Previous tag is TO to/TO race/NN → VB
2 VBP VB One of the previous 3 tags is MD might/MD vanish/VBP → VB
3 NN VB One of the previous 2 tags is MD might/MD not reply/NN → VB
4 VB NN One of the previous 2 tags is DT
5 VBD VBN One of the previous 3 tags is VBZ
Figure 5.22 The first 20 nonlexicalized transformations from Brill (1995).

the test set would then be optimistic: it would underestimate the true error rate. The problem with having a fixed training set, devset, and test set is that in order to save lots of data for training, the test set might not be large enough to be representative. Thus a better approach would be to somehow use all our data both for training and ssvalidation test. How is this possible? The idea is to use crossvalidation. In crossvalidation, we randomly choose a training and test set division of our data, train our tagger, and then compute the error rate on the test set. Then we repeat with a different randomly selected training set and test set. We do this sampling process 10 times, and then average these 10 runs to get an average error rate. This is called 10-fold crossvalidation. 10-fold ssvalidation The only problem with cross-validation is that because all the data is used for test- ing, we need the whole corpus to be blind; we can’t examine any of the data to suggest

HMM taggers

DET NOUN VERB DET NOUN PREP DET

The representative put the chairs on the

HMM taggers

DET NOUN VERB DET NOUN PREP DET

The representative put the chairs on the P(NOUN|DET)

Markov models can be extended to take more context

to account (bigrams, trigrams, etc.)

Problems with Markov taggers:

unknown words

long-distance relations

independence assumptions

More sophisticated statistical models are needed.

HMM taggers