当前位置:   article > 正文

N-grams

sklearn ngram和kenlm

Introduce probabilistic language modeling

let's thinking about the probability of sentence.

P(w1, w2, w3, w4)

= P(w1, w2, w3) * P(w4| w1, w2, w3)

= P(w1, w2) * P(w3| w1, w2) * P(w4| w1, w2, w3)

= P(w1) * P(w2| w1) * P(w3| w1, w2) * P(w4| w1, w2, w3)

 

Markov Assumption

 P(w1, w2, w3, w4...wn) = P(wn) * P (wn| wk, wk+1...wn)

for example

P(w1, w2, w3, w4)

= P(w1, w2, w3) * P(w4|w3)

= P(w1, w2) * P(w3|w2) * P(w4| w3)

= P(w1) * P(w2| w1) * P(w3|w2) * P(w4|w3)

Then it is easier.

And there are N-grams, 3-grams, 4-grams.

转载于:https://www.cnblogs.com/chuanlong/archive/2013/04/18/3029331.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/654979
推荐阅读
相关标签
  

闽ICP备14008679号