惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

MyScale Blog
MyScale Blog
F
Fortinet All Blogs
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
Docker
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
爱范儿
爱范儿
V
Visual Studio Blog
Last Week in AI
Last Week in AI
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
小众软件
小众软件
L
LangChain Blog
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
IT之家
IT之家
P
Proofpoint News Feed
博客园_首页
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss
The GitHub Blog
The GitHub Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
C
Check Point Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog

博客园 - Charleston

配置Windows 2008 R2 防火墙允许远程访问SQL Server 2008 R2 heroku空间部署步骤 网站部署后Parser Error Message: Could not load type 的解决方案 C#中准确跟踪错误异常所在的文件位置方法 *(转)超时时间已到。超时时间已到 但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用 并且达到了最大池大小。 情感分析资源 (转) 一些常用的NLTK频率分布类中定义的函数 利用Aspose.Cells完成easyUI中DataGrid数据的Excel导出功能 修改tt模板让ADO.NET C# POCO Entity Generator With WCF Support 生成的实体类继承自定义基类 利用ELMAH和Sqlite快速完成错误日志的捕获和存储 DbHelperSQL和Dapper数据访问的性能对比 Guide to Data Mining 读书笔记 相似度距离算法的取舍 情感分析面临的挑战 Ulipad中设置自定义模块(module)路径的方法(图) GAE的for application does not match expression '^(?:[a-z\d\-]{1,100}\~)?(?:(?!\-)[a-z\d 错误 - Charleston 利用HttpHandler和Jquery进行数据库增改删查操作 机器学习算法相关的开源架构介绍 JSON C# Class Generator ---由json字符串生成C#实体类的工具 Win7下附加sql2005数据库失败 错误代码5120的解决方法
布朗语料库中条件概率分布函数ConditionalFreqDist使用
Charleston · 2013-10-03 · via 博客园 - Charleston

布朗语料库中使用条件概率分布函数ConditionalFreqDist,可以查看每个单词在各新闻语料中出现的次数。这在微博情感分析中非常有用,比如判断feature vector中代表positive or negative or neutral的各feature在每条tweet中出现的次数高低来判断该tweet的情感极性。

from nltk.corpus import brown

cfd=nltk.ConditionalFreqDist(
(genre,word)
for genre in brown.categories()
for word in brown.words(categories=genre)
)
genres=['news','religion','hobbies','science_fiction','romance','humor']
modals=['can','could','may','might','must','will']
print cfd.tabulate(conditions=genres,samples=modals)

输出结果:

        can could may might must will
news 93 86 66 38 50 389
religion 82 59 78 12 54 71
hobbies 268 58 131 22 83 264
science_fiction 16 49 4 12 8 16
romance 74 193 11 51 45 43
humor 16 30 8 8 9 13
可以看出news分类中will一词出现最多,humor分类中could出现次数最多。