Docsity

LING 570 Homework 9: Creating and Testing a Trigram POS Tagger - Prof. Fei Xia, Assignments of Linguistics

Toggle sidebar
bg1
LING 570: Hw9
Due at 3pm on Nov 30
Hw9 is the continuation of Hw7 and Hw8. The example files are under dropbox/07-08/570/hw7/examples/
as before. Parts I-III are very similar to Parts IV-VI at Hw8, and Parts IV-VII are the smoothed
version of Parts I-III.
Part I (30 points): Write a script, create hmm2.sh, that creates an HMM for a trigram POS
tagger given the annotated training data. It is the same as create hmm.sh in Hw8, except that the
HMM is for a trigram tagger.
•The format is: cat training data |create hmm2.sh output hmm
•Don’t use any smoothing.
•In your note file, explain what the states in the HMM correspnd to, and what aij ,bj k and πi
represent, respectively. For instance, in a bigram tagger, a state corresponds to a tag in the POS
tagset, and aij is P(tj|ti).
Part II (10 points): Write a script, test hmm2.sh, that tags sentences using the hmm created in
Part I.
•The format is: test hmm2.sh hmm input sent output
•The formats of the files are the same as the ones used by test hmm.sh in Part V of Hw8.
•test hmm2.sh is very similar to test hmm.sh except for the postprocessing part.
Part III (10 points): Use wsj sec0.word pos as the training data, and wsj sec0.word as the test
data, run create hmm2.sh and test hmm2.sh, and compare the system output with the gold standard,
what is the tagging accuracy?
1
pf3

Partial preview of the text

Download LING 570 Homework 9: Creating and Testing a Trigram POS Tagger - Prof. Fei Xia and more Assignments Linguistics in PDF only on Docsity!

LING 570: Hw

Due at 3pm on Nov 30

Hw9 is the continuation of Hw7 and Hw8. The example files are under dropbox/07-08/570/hw7/examples/ as before. Parts I-III are very similar to Parts IV-VI at Hw8, and Parts IV-VII are the smoothed version of Parts I-III.

Part I (30 points): Write a script, create hmm2.sh, that creates an HMM for a trigram POS tagger given the annotated training data. It is the same as create hmm.sh in Hw8, except that the HMM is for a trigram tagger.

  • The format is: cat training data | create hmm2.sh output hmm
  • Don’t use any smoothing.
  • In your note file, explain what the states in the HMM correspnd to, and what aij , bjk and πi represent, respectively. For instance, in a bigram tagger, a state corresponds to a tag in the POS tagset, and aij is P (tj |ti).

Part II (10 points): Write a script, test hmm2.sh, that tags sentences using the hmm created in Part I.

  • The format is: test hmm2.sh hmm input sent output
  • The formats of the files are the same as the ones used by test hmm.sh in Part V of Hw8.
  • test hmm2.sh is very similar to test hmm.sh except for the postprocessing part.

Part III (10 points): Use wsj sec0.word pos as the training data, and wsj sec0.word as the test data, run create hmm2.sh and test hmm2.sh, and compare the system output with the gold standard, what is the tagging accuracy?

Part IV (50 points): Write a script, create hmm3.sh, that creates a smoothed HMM for a trigram POS tagger given the annotated training data.

  • The format is: cat training data | create hmm3.sh output hmm l1 l2 l3 unk prob file
  • l1, l2, and l3 are lambdas, and they should add up to one.
  • The format of unk prob file is: tag prob tag is a POS tag, and the prob is P (< unk >| tag).
  • create hmm3.sh is the same as create hmm2.sh in Part I, except that the probabilities in the HMM are smoothed in two places. - The transition probility will be smoothed with interpolation smoothing: Psmooth(t 3 |t 1 , t 2 ) = l 1 P (t 3 ) + l 2 P (t 3 |t 2 ) + l 3 P (t 3 |t 1 , t 2 ). - For an unknown word, use P (< unk >| tag) for the emission probability. The emission probability should be renormalized; that is, after the renormalization, P (< unk >| tag) stays the same, and sumwP (w | tag) = 1 − P (< unk >| tag) where w is a known word.
  • In your note file, answer the following questions.
    • Let N be the size of the POS tagset (excluding BOS and EOS). How many states are there in the HMM? How many transition lines are there?
    • Let M be the number of unique (word, tag) pairs that appear in the training data, and O be the number of (tag, prob) lines in unk prob file. How many emission lines are there in the HMM?
    • Write down the formula you used to renormalize P (w|tag).

Part V (10 points): Write a script, test hmm3.sh, that tags sentences using the hmm created in Part IV.

  • The format is: test hmm3.sh hmm input sent output
  • The formats of the files are the same as the ones used by test hmm2.sh in Part II.
  • The code is the same as test hmm2.sh except that it needs to be able to handle unknown words in the input sent; that is, no matter what a sentence is, your code should be able to find a best path for it.

Part VI (10 points): Write a wrapper, trigram tagger.sh, that does training, testing, and evalu- ation.

  • The format is: trigram tagger.sh training data test data gold standard output dir l1 l2 l3 unk prob file
  • The code will call the code you created in Parts IV and V and calc tagging accuracy.pl, etc.
  • The code will create a directory output dir and the following files under that directory:
    • hmm: the HMM created by create hmm3.sh.