File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ public function testAnalyzeSentiment($text, $expectedValues)
6565 $ info = $ result ->info ();
6666
6767 foreach ($ expectedValues as $ key => $ expected ) {
68- $ this ->assertEquals ($ expected , $ info [$ key ]);
68+ $ this ->assertEqualsWithDelta ($ expected , $ info [$ key ], 0.2 );
6969 }
7070 }
7171
@@ -147,17 +147,15 @@ public function testAnalyzeEntitySentiment($text, $expectedEntities)
147147 if ($ entity ['name ' ] == $ expectedEntity ['name ' ]) {
148148 $ exists = true ;
149149 $ this ->assertEquals ($ entity ['type ' ], $ expectedEntity ['type ' ]);
150- $ this ->assertEquals (
150+ $ this ->assertEqualsWithDelta (
151151 $ entity ['sentiment ' ]['score ' ],
152152 $ expectedEntity ['sentiment ' ]['score ' ],
153- '' ,
154153 0.2
155154 );
156155
157- $ this ->assertEquals (
156+ $ this ->assertEqualsWithDelta (
158157 $ entity ['sentiment ' ]['magnitude ' ],
159158 $ expectedEntity ['sentiment ' ]['magnitude ' ],
160- '' ,
161159 0.2
162160 );
163161
@@ -199,16 +197,16 @@ public function analyzeEntitySentimentProvider()
199197 'name ' => 'San Jose ' ,
200198 'type ' => 'LOCATION ' ,
201199 'sentiment ' => [
202- 'magnitude ' => 0.3 ,
203- 'score ' => 0.3 ,
200+ 'magnitude ' => 0.8 ,
201+ 'score ' => 0.8 ,
204202 ],
205203 ],
206204 [
207205 'name ' => 'road ' ,
208206 'type ' => 'LOCATION ' ,
209207 'sentiment ' => [
210- 'magnitude ' => 0.3 ,
211- 'score ' => 0.3 ,
208+ 'magnitude ' => 0.8 ,
209+ 'score ' => 0.8 ,
212210 ],
213211 ],
214212 ]
You can’t perform that action at this time.
0 commit comments