# Q2 (2 marks)

Subject: Natural Language Processing

Exam: M2

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

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

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

### Q2

A corpus has C(read)=10, C(read books)=6 and C(read papers)=4. Find both bigram conditional probabilities. (2 marks)

**Given**

read has 10 continuation opportunities; 6 are books and 4 are papers.

**To find**

P(books | read) and P(papers | read).

### Formula and why it applies



$$
P(w\mid h)=\frac{C(hw)}{C(h)}
$$



h is the preceding word. Divide each pair count by the count of its shared history.

### Solution

#### Step 1. Probability of books



$$
P(\text{books}\mid\text{read})=\frac6{10}=0.6
$$



#### Step 2. Probability of papers



$$
P(\text{papers}\mid\text{read})=\frac4{10}=0.4
$$



#### Step 3. Check the complete row



$$
0.6+0.4=1
$$



P(books | read)=0.6 and P(papers | read)=0.4.
