File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed
Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -35,11 +35,9 @@ function annotation_to_string(Annotation $annotation)
3535
3636 if (isset ($ info ['documentSentiment ' ])) {
3737 $ magnitude = $ info ['documentSentiment ' ]['magnitude ' ];
38- $ polarity = $ info ['documentSentiment ' ]['polarity ' ];
39- if ($ polarity < 0 ) {
40- $ magnitude = -$ magnitude ;
41- }
42- $ ret .= sprintf ('sentiment: %s ' . PHP_EOL , $ magnitude );
38+ $ score = $ info ['documentSentiment ' ]['score ' ];
39+ $ ret .= sprintf ('sentiment magnitude: %s score: %s ' . PHP_EOL ,
40+ $ magnitude , $ score );
4341 }
4442
4543 if (isset ($ info ['sentences ' ])) {
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ public function testSentiment()
5757 );
5858
5959 $ output = $ this ->commandTester ->getDisplay ();
60- $ this ->assertRegExp ('/sentiment: / ' , $ output );
60+ $ this ->assertRegExp ('/sentiment/ ' , $ output );
6161 }
6262
6363 public function testSentimentFromStorageObject ()
You can’t perform that action at this time.
0 commit comments