本次课主要介绍了两个模型n-gram和RNN
语言模型
语言模型是一个预测一句话中的下一个单词的任务
也就是说,给定单词[x1,x2,x3,x4...xt],预测下一个单词x(t+1)是什么单词.x(t+1)是给定词汇表V={w1,w2,...,Wv}中的单词。
也可以把语言模型理解为给一段文本分配概率的模型。
比如说,有一段文本x1,x2,x3,xt,这个文本的概率是:
n-gram语言模型
给定一句话:
the student open their ______
预测空白处可能是什么单词。
如何预测?使用n-gram语言模型。
一个n-gram是指一系列单词,如果说
- unigram(n=1):“the”, “students”, “opened”, ”their”
- bigrams(n=2): “the students”, “students opened”, “opened their”
- trigrams(n=3): “the students opened”, “students opened their”
- 4-grams(n=4): “the students opened their”
使用频率来计算n-gram的概率。
n-gram模型是假设预测单词出现的概率与前n-1个单词有关。<