我试图强调三克,并以最高概率预测下一个可能的单词并计算一些单词概率,给定一个长文本或语料库。
以下是我的代码到目前为止,我能够获取输入数据集。
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(" "))