Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PYTHON Consider the following sentences written in Klingon. For each sentence, t

ID: 3858766 • Letter: P

Question

PYTHON

Consider the following sentences written in Klingon. For each sentence, the part of speech of each “word” has been given (for ease of translation, some prefixes/suffixes have been treated as words), along with a translation. Using these training sentences, we’re going tobuild a Hidden Markov Model(HMM)to predict the part of speech of an unknown sentence using the Viterbi algorithm.

N PRO V N PRO

pa’Daq   ghah taH tera’ngan ’e

room (inside) he is human of

The human is in the room

V N V N

ja’chuqmeH rojHom neH tera’ngan

in orderto parley truce want human

The enemy commander wants a truce in order to parley

N V N CONJ N V N

tera’ ngan  qIp   puq ’eg puq qIp   tera’ngan

human bit child and child bit child

The child bit the human, and the human bit the child

Step 1: Creating the Emission probability table(emission.javaor emission.py)Create a Emission probability table by computingthe frequencies of each part of speech in thetable below for all POS tags. We’ll use a smoothing factor of 0.1 (as discussed in class) to make sure that no event is impossible; add this number to all of your observations. Sample table valuesof two parts of speechhave been shown.Probability(word|tag) = Count(word,tag) / Count(tag)

Explanation / Answer

egin{tabular}{llllll} N & PRO & V & N & PRO \ pa'Daq & ghah & taH & tera'ngan & 'e \ room (inside) & he & is & human & of \ multicolumn{6}{c}{{em The human is in the room}} \ end{tabular} egin{tabular}{llll} V & N & V & N \ ja'chuqmeH & rojHom & neH & tera'ngan \ in order to parley & truce & want & human \ multicolumn{4}{c}{{em The enemy commander wants a truce in order to parley}} end{tabular} egin{tabular}{lllllll} N & V & N & CONJ & N & V & N \ tera'ngan & qIp & puq & 'eg & puq & qIp & tera'ngan \ human & bit & child & and & child & bit & child \ multicolumn{7}{c}{{em The child bit the human, and the human bit the child}} end{tabular}