2017年7月4日星期二
n-gram算法
我的简单理解:
依赖于隐马尔科夫模型进行大规模语言识别的一种模型。
One question: 可以用来做什么
Two:详细过程
通常计算一句话的概率:如(w1,w2,w3,w4,w5,...,wn)为:
p(w1,w2,w3,...,wn)=p(w1)*p(w2|w1)*p(w3|w1,w2)*...*p(wn|w1,w2,...,w n-1)
但是在n-gram中, 假设一个单词只跟前n即后n字词相关
即若为1-gram的话,
p(w1,w2,w3,...,wn)=p(w1)*p(w2|w1)*p(w3|w2)*...*p(wn|w n-1)
若为2-gram的话,
p(w1,w2,w3,...,wn)=p(w1)*p(w2|w1)*p(w3|w2,w1)*...*p(wn|w n-1,w n-2)
以此类推
订阅:
博文评论 (Atom)
leetcode 17
17. Letter Combinations of a Phone Number Medium Given a string containing digits from 2-9 inclusive, return all possible l...
-
ptb的代码可以详见gitlab上的tensorflow/models/tutorials下,本文只详解他的数据前处理和模型部分。 1.运行 首先说一下他的运行 ,下载数据集: http://www.fit.vutbr.cz/~imikolov/rnnlm/simple-e...
-
写在开头,以下是我在过程中遇到的一些问题 1.关于KNN算法代码里的一些问题 1.1关于numpy的sum用法 Check out the documentation for numpy.sum, paying particular attention to the ...
没有评论:
发表评论