-
Notifications
You must be signed in to change notification settings - Fork 1
/
sentiment_custom_options.js
38 lines (37 loc) · 1.24 KB
/
sentiment_custom_options.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// These custom options include and score key words and phrases associated with the cryptocurrency market (e.g., "bear market," "bull market," "selloff," and "recovery") that are not included in the AFINN-165 word list used by the Sentiment module. Additionally, the default scoring strategy for negation is improved by adding more words that negate.
module.exports.options = {
extras: {
'bear': -4,
'bears': -4,
'bear market': -4,
'down': -3,
'decline': -3,
'declines': -3,
'declining': -3,
'falls': -3,
'sell': -3,
'selling': -3,
'selloff': -4,
'bull': 4,
'bulls': 4,
'bull market': 5,
'boom': 3,
'buy': 3,
'bought': 3,
'comeback': 3,
'recover': 3,
'recovery': 3,
'recovering': 3
},
scoringStrategy: {
apply: function(tokens, cursor, tokenScore) {
if (cursor > 0) {
let prevtoken = tokens[cursor - 1];
if (prevtoken === 'not' || prevtoken === 'aren\'t' || prevtoken === 'isn\'t' || prevtoken === 'don\'t' ) {
tokenScore = -tokenScore
}
}
return tokenScore;
}
}
}