

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Parts I-IV are the continuation of Hw5, and will use the same example files under dropbox/07- 08/570/hw5/examples/ as Hw5. Parts V and VI are a followup of Quiz #2 and do not require programming.
Part I (20 points): Write a script, pp11.sh, that calculates the perplexity of a test data given an LM built with GT smoothing.
Part II (10 points): Write a script, build lm2.sh, that builds an LM using ngram counts.
P (w 3 |w 1 , w 2 ) = cnt(w 1 , w 2 , w 3 ) cnt(w 1 , w 2 ) Bigram and unigram models are calculated similarly.
Part III (10 points): Write a script, ppl2.sh, that calculates the perplexity of a test data given an LM built by build lm2.sh in Part II.
Part IV (30 points): Use hw5/examples/wsj sec0 19.word as training data, and calculate the per- plexity of hw5/examples/wsj sec22.word.
Table 1: The perplexity of the test data with different λs and LMs λ 1 λ 2 λ 3 GT lm MLE lm 0.05 0.15 0. 0.1 0.1 0. 0.2 0.3 0. 0.2 0.5 0. 0.2 0.7 0. 0.2 0.8 0 1.0 0 0
(a) 15 points: Fill out Table 1, where each cell is the value of perplexity given the LM and λs. For the GT lm column, the lm is built by build lm.sh and the perplexity is calculated by ppl1.sh. For the MLE lm column, the lm is built by build lm2.sh and the perplexity is calculated by ppl2.sh. The perplexity should be between 100 and 2000. (b) 10 points: Try 10 more λ combinations, and show the results in a table like Table 1. Among the λ values you have tried so far, which yields the lowest perplexity for GT lm? Which yields the lowest perplexity for MLE lm? (c) 5 points: What can you conclude from these experiments?
Part V (20 points): Draw FSTs for the following regular relations.
(a) 5 points: R1 = {(a^2 n+1, bn) | n ≥ 0 }
⋃ {(an, b^2 n) | n ≥ 0 } (b) 5 points: R2 = {(a^2 n, (bcd)n) | n ≥ 0 } (c) 10 points: The FST will take a word x as the input, where a word is [a-z]+. If the word has at least seven characters and ends with -ing, the FST will output the word with -ing removed; otherwise, the FST will output the word unchanged. For instance, if the input is “walking”, the output will be “walk”. If the input is “fixing” or “walkings”, the output will be the same as the input. For the sake of simplicity, you can use the wildcard symbol *, which will match any input symbol. Note that the FST can be non-deterministic; that is, there could be multiple edges coming out of the same node with the same input symbols.
Part VI (10 points): Write a context-free grammar for the language {a+b^3 nc∗d^2 ne∗^ | n ≥ 0 }. Explain what each non-terminal symbol stands for. For instance, S 1 stands for the string c∗.
Submission: There are several ways to submit Part V: