Natural Language Processing · M2 · mocks

Q2 (2 marks)

M2 Mock A · core calculations

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)}LaTeX: 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.6LaTeX: P(\text{books}\mid\text{read})=\frac6{10}=0.6

Step 2. Probability of papers

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

Step 3. Check the complete row

0.6+0.4=1LaTeX: 0.6+0.4=1
P(books | read)=0.6 and P(papers | read)=0.4.