CS267
Chris Pollett
Feb 2, 2022
On Monday, we were talking about language modeling. Let's briefly recall some of the things we learned...
Suppose the phrase "before me" appears 4 times in Shakespeare and "before" appear 2048 times.
What is `M_0(mbox("before me"))`? What is `M_1(mbox("me") | mbox("before"))`?
Post your solutions to the Feb 2 In-Class Exercise Thread.
<DOC> <DOCNO>LA051990-0141<DOCNO> <HEADLINE>COUNCIL VOTES TO EDUCATE DOG OWNERS</HEADLINE> <P> The City Ccouncil stepped carefully around enforcement of the dog-curbing ordinance this week, vetoing the use of police to enforce the law. </P> ... </DOC>
nextPhrase(t[1],t[2], .., t[n], position)
{
v:=position
for i = 1 to n do
v:= next(t[i], v)
if v == infty then // infty represents after the end of the posting list
return [infty, infty]
u := v
for i := n-1 downto 1 do
u := prev(t[i],u)
if(v-u == n - 1) then
return [u, v]
else
return nextPhrase(t[1],t[2], .., t[n], u)
}