随笔分类 - NLTK自然语言处理(python)读书笔记
摘要:1、Sublime Text中用Tab批量替换空格Whitespace缩进:Ctrl+A全选代码,Ctrl+Shift+P打开下拉框,输入indent,找到Convert indentation to Tabs单击即可。 2、在训练集的处理过程中,将txt格式转化xml后发现 xml中的& 和<符号
阅读全文
摘要:布朗语料库中使用条件概率分布函数ConditionalFreqDist,可以查看每个单词在各新闻语料中出现的次数。这在微博情感分析中非常有用,比如判断feature vector中代表positive or negative or neutral的各feature在每条tweet中出现的次数高低来判断该tweet的情感极性。from nltk.corpus import browncfd=nltk.ConditionalFreqDist((genre,word)for genre in brown.categories()for word in brown.words(categories=g
阅读全文