Natural Language Processing · M2 · papers
Q4B · A second HMM sequence
Solved re-exam · February 2026
M2-relevant questions from an actual TEE paper · original marks retained for longer practice
1. Dog/Noun eats/Verb bread/Noun
2. The/Det cat/Noun sleeps/Verb
3. A/Det dog/Noun eats/Verb fish/Noun
i. Construct the emission probability matrix.
ii. Construct the transmission probability matrix.
iii. Calculate the probability of the given sequence of events: The/Det dog/Noun eats/Verb bread/Noun.
Note: Include start and end characters for all the sentences. [10 marks]
Answer
The repeated verb eats has a different emission count from the final paper; recalculate it rather than copying the previous numerical result.
Given
| Sentence | Tagged sequence |
|---|---|
| 1 | dog/Noun eats/Verb bread/Noun |
| 2 | the/Det cat/Noun sleeps/Verb |
| 3 | a/Det dog/Noun eats/Verb fish/Noun |
Lowercase the corpus. Test sequence: the/Det dog/Noun eats/Verb bread/Noun. Add Start and End markers.
To find
Emission and transition matrices, then the probability of the supplied tagged sequence.
Formula: which one and why
P(w\mid t)=\frac{C(t,w)}{C(t)}P(t_j\mid t_i)=\frac{C(t_i,t_j)}{\sum_kC(t_i,t_k)}Emission divides the word’s tag-specific count by the total tokens with that tag. Transition divides the tag-pair count by all transitions leaving the previous tag, including End.
P(\mathbf w,\mathbf t)=P(t_1\mid\mathrm{Start})\prod_iP(w_i\mid t_i)\prod_{i=2}^{n}P(t_i\mid t_{i-1})P(\mathrm{End}\mid t_n)Solution
Step 1. Count tag totals and word frequencies
Det: the=1, a=1, total2. Noun: dog=2, bread=1, cat=1, fish=1, total5. Verb: eats=2, sleeps=1, total3.
Step 2. Construct emission matrix
| Tag / word | a | bread | cat | dog | eats | fish | sleeps | the |
|---|---|---|---|---|---|---|---|---|
| Det | 1/2 | 0 | 0 | 0 | 0 | 0 | 0 | 1/2 |
| Noun | 0 | 1/5 | 1/5 | 2/5 | 0 | 1/5 | 0 | 0 |
| Verb | 0 | 0 | 0 | 0 | 2/3 | 0 | 1/3 | 0 |
Step 3. Count transitions from the three chains
Start → Noun → Verb → Noun → End
Start → Det → Noun → Verb → End
Start → Det → Noun → Verb → Noun → End
| From | Det count | Noun count | Verb count | End count | Total |
|---|---|---|---|---|---|
| Start | 2 | 1 | 0 | 0 | 3 |
| Det | 0 | 2 | 0 | 0 | 2 |
| Noun | 0 | 0 | 3 | 2 | 5 |
| Verb | 0 | 2 | 0 | 1 | 3 |
Step 4. Divide outgoing counts
| From / to | Det | Noun | Verb | End |
|---|---|---|---|---|
| Start | 2/3 | 1/3 | 0 | 0 |
| Det | 0 | 1 | 0 | 0 |
| Noun | 0 | 0 | 3/5 | 2/5 |
| Verb | 0 | 2/3 | 0 | 1/3 |
All nonterminal rows sum to one. No smoothing is requested.
Step 5. Write every sequence factor
| Event | Probability |
|---|---|
| Start → Det | 2/3 |
| Det emits the | 1/2 |
| Det → Noun | 1 |
| Noun emits dog | 2/5 |
| Noun → Verb | 3/5 |
| Verb emits eats | 2/3 |
| Verb → Noun | 2/3 |
| Noun emits bread | 1/5 |
| Noun → End | 2/5 |
Step 6. Multiply all factors
P=\frac23\times\frac12\times1\times\frac25\times\frac35\times\frac23\times\frac23\times\frac15\times\frac25Start with subtotal 1. At each row, multiply the previous subtotal by exactly one next factor. Simplify the fraction after multiplication, but do not round it.
| Factor being included | Previous subtotal × next factor = new subtotal |
|---|---|
| 1. Start → Det | 1\times\frac{2}{3}=\frac{2}{3} |
| 2. Det emits the | \frac{2}{3}\times\frac{1}{2}=\frac{1}{3} |
| 3. Det → Noun | \frac{1}{3}\times1=\frac{1}{3} |
| 4. Noun emits dog | \frac{1}{3}\times\frac{2}{5}=\frac{2}{15} |
| 5. Noun → Verb | \frac{2}{15}\times\frac{3}{5}=\frac{2}{25} |
| 6. Verb emits eats | \frac{2}{25}\times\frac{2}{3}=\frac{4}{75} |
| 7. Verb → Noun | \frac{4}{75}\times\frac{2}{3}=\frac{8}{225} |
| 8. Noun emits bread | \frac{8}{225}\times\frac{1}{5}=\frac{8}{1125} |
| 9. Noun → End | \frac{8}{1125}\times\frac{2}{5}=\frac{16}{5625} |
The last subtotal is the complete product. Only now convert the fraction to a decimal.
P=\frac{16}{5625}\approx0.0028444444Final answer
P = 16/5625 ≈ 0.0028444444 for these words and specified tags jointly. The two occurrences of eats give P(eats | Verb) = 2/3.
Yaad rakho: Same tag structure ho sakta hai, lekin word emission counts dobara count karna.
Boundary reminder: Include P(Det | Start) = 2/3 and P(End | Noun) = 2/5. The handwritten key’s final line instead inserts the overall Det fraction 2/10 and omits End; the complete boundary-aware probability requested here is 0.0028444444.