如何使用NLTK Python N克计算单词的概率并预测下一个单词

时间:2017-01-21 17:15:30

标签: python nlp nltk n-gram

我试图强调三克,并以最高概率预测下一个可能的单词并计算一些单词概率,给定一个长文本或语料库。

以下是我的代码到目前为止,我能够获取输入数据集。

words = "If I had stayed in at budget chain hotels ; not pricier historic hotels ; such as Millenium Park ; the Aon center ( there is a Starbucks at the bottom ; but only limited opening hours ; the lobby ; but when the young woman at the front desk ; someone finally came and said that it was y husband 's first trip to Chicago and the hotel is first class and the accommodations are unbeatable ."
tri = trigrams(words.split(" "))

0 个答案:

没有答案