Natural Language Processing · TEE · papers

Q6a · Henry bigram continuations

2024-12-03 · final · recovered AI paper

Previous examination · complete worked answers

Question. From the seven supplied training sentences below, predict the most probable next token for <s> Do ..., <s> I like ..., and <s> I ... using bigrams. [10 marks]

Answer

Given

<s> I am Henry </s>
<s> I like college </s>
<s> Do Henry like college </s>
<s> Henry I am </s>
<s> Do I like Henry </s>
<s> Do I like college </s>
<s> I do like Henry </s>

To find

Most probable next token for each prefix.

Formula: which one and why

P(w\mid h)=\frac{c(h,w)}{\sum_v c(h,v)}LaTeX: P(w\mid h)=\frac{c(h,w)}{\sum_v c(h,v)}

Retain case exactly; include sentence-end as an observed next token. Bigram prediction uses only the last token of the prefix.

Step 1. Count each adjacent pair separately within sentences

BigramCount
<s> → Do3
<s> → Henry1
<s> → I3
Do → Henry1
Do → I2
Henry → </s>3
Henry → I1
Henry → like1
I → am2
I → do1
I → like3
am → </s>1
am → Henry1
college → </s>3
do → like1
like → Henry2
like → college3

Step 2. Continue <s> Do

CandidateCount / history countProbability
Henry1/30.333333
I2/30.666667

Highest: I.

Step 3. Continue <s> I like

CandidateCount / history countProbability
Henry2/50.400000
college3/50.600000

Highest: college.

Step 4. Continue <s> I

CandidateCount / history countProbability
am2/60.333333
do1/60.166667
like3/60.500000

Highest: like.

Final answer

<s> Do → I
<s> I like → college
<s> I → like

If an examiner explicitly restricts the answer to a lexical word, exclude END and state that restricted candidate set. Do not silently remove an END tie.

Source / convention note. Case is retained as printed: Do and do are distinct. The corpus is not silently grammatically corrected.