@@ -97,7 +97,7 @@ public function testGetPolarityScores()
97
97
$ examples [] = ['sent ' => "Make sure you :) or :D today! " , 'neg ' => 0.0 , 'neu ' => 0.294 , 'pos ' => 0.706 , 'compound ' => 0.8633 ];
98
98
$ examples [] = ['sent ' => "Today SUX! " , 'neg ' => 0.0 , 'neg ' => 0.779 , 'neu ' => 0.221 , 'pos ' => 0.0 , 'compound ' => -0.5461 ];
99
99
$ examples [] = ['sent ' => "Today only kinda sux! But I'll get by, lol " , 'neg ' => 0.179 , 'neu ' => 0.569 , 'pos ' => 0.251 , 'compound ' => 0.2228 ];
100
-
100
+
101
101
$ vader = new Vader ;
102
102
103
103
foreach ($ examples as $ test )
@@ -113,9 +113,43 @@ public function testIssue44OffsetError()
113
113
return ;
114
114
}
115
115
116
- $ vader = new Vader ;
116
+ $ vader = new Vader ;
117
117
$ result = $ vader ->getPolarityScores ([ 'great ' , 'for ' , 'the ' , 'jawbone ' ]);
118
118
$ this ->assertEquals (0.577 , $ result ['pos ' ]);
119
119
}
120
+
121
+ public function testSentimentScoreKindOfCombo ()
122
+ {
123
+ if ( getenv ('SKIP_TEST ' )) {
124
+ return ;
125
+ }
126
+
127
+ $ sentimentScores = vader (['kind ' ]);
128
+
129
+ $ this ->assertEquals (0.6197 , $ sentimentScores ['compound ' ]);
130
+ }
131
+
132
+ public function testNormalizeZeroSum ()
133
+ {
134
+ if ( getenv ('SKIP_TEST ' )) {
135
+ return ;
136
+ }
137
+ $ tokens = [
138
+ 'If ' ,'the ' ,'Fake ' ,'News ' ,'Opposition ' ,'Party ' ,
139
+ 'is ' ,'pushing ' ,'with ' ,'all ' ,'their ' ,'might ' ,
140
+ 'the ' ,'fact ' ,'that ' ,'President ' ,'Trump ' ,
141
+ '“ignored ' ,'early ' ,'warnings ' ,'about ' ,
142
+ 'the ' ,'threat ' ,'” ' ,'then ' ,'why ' ,'did ' ,
143
+ 'Media ' ,'& ' ,'Dems ' ,'viciously ' ,
144
+ 'criticize ' ,'me ' ,'when ' ,'I ' ,
145
+ 'instituted ' ,'a ' ,'Travel ' ,'Ban ' ,
146
+ 'on ' ,'China ' ,'They ' ,'said ' ,
147
+ '“early ' ,'& ' ,'not ' ,'necessary.” ' ,'Corrupt ' ,'Media '
148
+ ];
149
+
150
+ $ sentimentScores = vader ($ tokens );
151
+
152
+ $ this ->assertEquals (-1 , $ sentimentScores ['compound ' ]);
153
+ }
120
154
121
155
}
0 commit comments