# Q4 (3 marks)

Subject: Natural Language Processing

Exam: M2

Reader: https://deep-learning-study-room.vercel.app/nlp/#m2/mocks/mock-a/q4

Canonical: https://deep-learning-study-room.vercel.app/read/nlp/m2/mocks/mock-a--q4/

M2 · confirmed 2 + 2 + any two of 3 + 3 + 3 · worked practice

### Q4

An HMM has P(N|start)=0.6, P(V|N)=0.5, P(end|V)=0.4, P(dogs|N)=0.5 and P(run|V)=0.8. Find the joint probability of words “dogs run” with tag path N,V, including the end transition. (3 marks)

**Given**

The five required transition/emission factors are supplied.

**To find**

P(dogs run, N V, end).

### Formula and why it applies



$$
P(w,t)=P(t_1\mid start)P(w_1\mid t_1)P(t_2\mid t_1)P(w_2\mid t_2)P(end\mid t_2)
$$



Transitions move between tags. Emissions generate words from tags. Include both types of factor.

### Solution

#### Step 1. Place the factors along the path

start → N: 0.6

→

emit dogs: 0.5

→

N → V: 0.5

→

emit run: 0.8

→

V → end: 0.4

#### Step 2. First word contribution



$$
0.6\times0.5=0.3
$$



#### Step 3. Enter V and emit run



$$
0.3\times0.5=0.15
$$





$$
0.15\times0.8=0.12
$$



#### Step 4. End the sentence



$$
0.12\times0.4=0.048
$$



Joint path-and-word probability = 0.048. This is not a normalised posterior over tag paths.
