Lau*_*ber 2 python nlp nltk lexicon vader
我希望有人能纠正我对VADER如何评分文字的理解。我在这里已阅读了此过程的说明,但是在重新创建它描述的过程时,我无法将测试句子的综合得分与Vader的输出相匹配。假设我们有这样的句子:
"I like using VADER, its a fun tool to use"
Run Code Online (Sandbox Code Playgroud)
VADER拿起的单词是“喜欢”(+1.5分)和“有趣”(+2.3分)。根据文档,将这些值相加(等于+3.8),然后使用以下函数将其标准化为0到1之间的范围:
(alpha = 15)
x / x2 + alpha
Run Code Online (Sandbox Code Playgroud)
根据我们的数字,这应该变成:
3.8 / 14.44 + 15 = 0.1290
Run Code Online (Sandbox Code Playgroud)
但是,VADER输出的复合分数如下:
Scores: {'neg': 0.0, 'neu': 0.508, 'pos': 0.492, 'compound': 0.7003}
Run Code Online (Sandbox Code Playgroud)
我的推理哪里出错了?曾多次问过类似的问题,但是尚未提供VADER分类的实际示例。任何帮助,将不胜感激。
只是归一化是错误的。从代码中定义函数:
def normalize(score, alpha=15):
"""
Normalize the score to be between -1 and 1 using an alpha that
approximates the max expected value
"""
norm_score = score/math.sqrt((score*score) + alpha)
return norm_score
Run Code Online (Sandbox Code Playgroud)
所以你有3.8 / sqrt(3.8 * 3.8 + 15)= 0.7003
| 归档时间: |
|
| 查看次数: |
532 次 |
| 最近记录: |