贝叶斯NLP迷你项目

本文档是关于贝叶斯自然语言处理的迷你项目,涉及计算单词在特定上下文出现的概率,展示最佳分类器示例,以及讨论最大可能性原则在句子填充中的应用。
摘要由CSDN通过智能技术生成

贝叶斯NLP迷你项目

计算

练习: Calculations
让我们计算一下上一页中提到问题。这里是一段你老板的留言:

“So if you could just go ahead and pack up your stuff and move it down there, that would be terrific, OK?”
基于上面这句话,计算下列情况的概率:

单词 you 跟在单词 if 后面的概率是多少
在句子中,随机选择一个词,选到 you 的概率是多少
在句子中,随机选择一个词,选到 if 的概率是多少

最佳分类器示例

练习: Optimal Classifier Example
想象一下如果我们有连续的两个缺失的单词。与其在第一个空位选择可能性最大的那个单词,然后基于这个单词来预测第二个单词,我们还可以计算可能出现在第一个空位所有单词的可能性。

例如,在下列句子中:

“For ——”

在前面的句子中:

你预测第二个空格应该填哪个单词?

填这个单词的概率是多少?

最大可能性

sample_memo = '''
Milt, we're gonna need to go ahead and move you downstairs into storage B. We have some new people coming in, and we need all the space we can get. So if you could just go ahead and pack up your stuff and move it down there, that would be terrific, OK?
Oh, and remember: next Friday... is Hawaiian shirt day. So, you know, if you want to, go ahead and wear a Hawaiian shirt and jeans.
Oh, oh, and I almost forgot. Ahh, I'm also gonna need you to go ahead and come in on Sunday, too...
Hello Peter, whats happening? Ummm, I'm gonna need you to go ahead and come in tomorrow. So if you could be here around 9 that would be great, mmmk... oh oh! and I almost forgot ahh, I'm also gonna need you
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值