若是不進行平滑處理,會面臨數據稀疏的問題,這會使聯合機率的其中一項值爲0,從而致使句子的總體機率值爲0。算法
例子:
框架
第一次迭代(此時的輸出字符爲A):
\[\delta _ { 1 } ( 0 ) = 0.5*0.5=0.25\]
\[\delta _ { 1 } ( 1 ) = 0.5*0.3=0.15\]
\[\delta _ { 1 } ( 2 ) = 0*0.2=0\]編碼
第二次迭代(此時的輸出字符爲B):
\[\delta _ { 2 } ( 0 ) = max(0.25*0.3*0.3, 0, 0)=0.0225\]
\[\delta _ { 2 } ( 1 ) =max(0.25*0.2*0.4, 0.15*0.4*0.4, 0)=0.024\]
\[\delta _ { 2 } ( 2 ) = max(0.25*0.5*0.3, 0.15*0.6*0.3, 0)=0.0375\]spa
第三次迭代(此時的輸出字符爲C):
\[\delta _ { 3 } ( 0 ) = max(0.0225*0.3*0.2, 0, 0)=0.00135\]
\[\delta _ { 3 } ( 1 ) =max(0.0225*0.2*0.3, 0.024*0.4*0.3, 0)=0.00288 \]
\[\delta _ { 3 } ( 2 ) =max(0.0225*0.5*0.5, 0.024*0.6*0.5, 0)=0.0072\]blog
最終答案:
遞歸