I hope it isn't off topic but I need to understand this example. Given the corpus 12 1 13 12 15 234 2526
and smoothing factor of k=1
. The example does the following operations:
Considers OOV(out of vocabulary) words and assigns them a zero times value, after that k=1
is added to the times every words appears, to avoid zero probabilities. So the result of smoothing the bigrams probability will be:
$P(1|12)=(1+k)/(2+2+6*k)=0.2$
$P(15|12)=(1+k)/(2+2+6*k)=0.2$
$P(13|1)=(1+k)/(2+6*k)=0.25$
$P(12|13)=(1+k)/(2+6*k)=0.25$
$P(234|15)=(1+k)/(2+6*k)=0.25$
$P(2526|234)=(1+k)/(2+6*k)=0.25$
My question is, What kind of smoothing is this? shouldn't be for example like this?; $P(1|12)=(1+k)/(2+6*k)=0.25$
Besides it also says "If OOV words appear, you need to use smoothing to return a value; $P(234|12)=1/((2/7)*6+6)=0.1296$"
PS: I take this example from a small section of the translated version of this chinese webpage, it is just explaining a code implementation.