@@ -97,7 +97,7 @@ public function testGetPolarityScores()
9797 $ examples [] = ['sent ' => "Make sure you :) or :D today! " , 'neg ' => 0.0 , 'neu ' => 0.294 , 'pos ' => 0.706 , 'compound ' => 0.8633 ];
9898 $ examples [] = ['sent ' => "Today SUX! " , 'neg ' => 0.0 , 'neg ' => 0.779 , 'neu ' => 0.221 , 'pos ' => 0.0 , 'compound ' => -0.5461 ];
9999 $ 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+
101101 $ vader = new Vader ;
102102
103103 foreach ($ examples as $ test )
@@ -113,9 +113,43 @@ public function testIssue44OffsetError()
113113 return ;
114114 }
115115
116- $ vader = new Vader ;
116+ $ vader = new Vader ;
117117 $ result = $ vader ->getPolarityScores ([ 'great ' , 'for ' , 'the ' , 'jawbone ' ]);
118118 $ this ->assertEquals (0.577 , $ result ['pos ' ]);
119119 }
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+ }
120154
121155}
0 commit comments