我使用vader
中的nltk
来查找文件中每一行的情感。我有两个问题:
- 我需要在
vader_lexicon.txt
中添加单词,但是其语法如下:
assaults -2.5 0.92195 [-1, -3, -3, -3, -4, -3, -1, -2, -2, -3]
-2.5
和{}代表什么?在
我该如何为新单词编码?假设我必须添加类似'100%'
,'A1'
之类的内容。在
- 我还可以在
nltk_data\corpora\opinion_lexicon
文件夹中看到正反两个单词txt。这些是如何利用的?我可以在这些txt文件中添加我的文字吗?在
Tags:
我相信维德在对文本进行分类时只使用单词和第一个值。如果要添加新词,只需创建一个单词词典及其情感值,可以使用update函数添加:
您可以根据感知到的情绪强度手动为单词指定情绪值,或者如果这不可行,则可以为两个类别指定一个广泛的值(例如-1.5和1.5)。在
您可以使用此脚本(不是我的脚本)来检查是否包含了您的更新:
^{pr2}$在更新维德之前:
在用基于金融的词汇更新维德之后:
相关问题 更多 >
编程相关推荐