@@ -252,7 +252,7 @@ Document.PART_OF_SPEECH = { |
252 | 252 | * @param {string} callback.annotation.language - The language detected from the |
253 | 253 | * text. |
254 | 254 | * @param {number} callback.annotation.sentiment - A value in the range of |
255 | | - * `-100` to `100`. Large numbers represent more positive sentiments. |
| 255 | + * `-1` (negative) to `1` (positive). |
256 | 256 | * @param {object} callback.annotation.entities - The recognized entities from |
257 | 257 | * the text, grouped by the type of entity. |
258 | 258 | * @param {string[]} callback.annotation.entities.art - Art entities detected |
@@ -321,7 +321,7 @@ Document.PART_OF_SPEECH = { |
321 | 321 | * |
322 | 322 | * // annotation = { |
323 | 323 | * // language: 'en', |
324 | | - * // sentiment: 100, |
| 324 | + * // sentiment: 1, |
325 | 325 | * // entities: { |
326 | 326 | * // organizations: [ |
327 | 327 | * // 'Google' |
@@ -387,7 +387,7 @@ Document.PART_OF_SPEECH = { |
387 | 387 | * |
388 | 388 | * // annotation = { |
389 | 389 | * // language: 'en', |
390 | | - * // sentiment: 100, |
| 390 | + * // sentiment: 1, |
391 | 391 | * // entities: { |
392 | 392 | * // organizations: [ |
393 | 393 | * // 'Google' |
@@ -414,7 +414,7 @@ Document.PART_OF_SPEECH = { |
414 | 414 | * // annotation = { |
415 | 415 | * // language: 'en', |
416 | 416 | * // sentiment: { |
417 | | - * // score: 100, |
| 417 | + * // score: 1, |
418 | 418 | * // magnitude: 4 |
419 | 419 | * // }, |
420 | 420 | * // entities: { |
@@ -425,7 +425,7 @@ Document.PART_OF_SPEECH = { |
425 | 425 | * // metadata: { |
426 | 426 | * // wikipedia_url: 'http://en.wikipedia.org/wiki/Google' |
427 | 427 | * // }, |
428 | | - * // salience: 65.137446, |
| 428 | + * // salience: 0.65137446, |
429 | 429 | * // mentions: [ |
430 | 430 | * // { |
431 | 431 | * // text: { |
@@ -444,7 +444,7 @@ Document.PART_OF_SPEECH = { |
444 | 444 | * // metadata: { |
445 | 445 | * // wikipedia_url: 'http://en.wikipedia.org/wiki/United_States' |
446 | 446 | * // }, |
447 | | - * // salience: 13.947370648384094, |
| 447 | + * // salience: 0.13947370648384094, |
448 | 448 | * // mentions: [ |
449 | 449 | * // { |
450 | 450 | * // text: [ |
@@ -646,7 +646,7 @@ Document.prototype.annotate = function(options, callback) { |
646 | 646 | * // metadata: { |
647 | 647 | * // wikipedia_url: 'http: * //en.wikipedia.org/wiki/Google' |
648 | 648 | * // }, |
649 | | - * // salience: 65.137446, |
| 649 | + * // salience: 0.65137446, |
650 | 650 | * // mentions: [ |
651 | 651 | * // { |
652 | 652 | * // text: { |
@@ -664,7 +664,7 @@ Document.prototype.annotate = function(options, callback) { |
664 | 664 | * // metadata: { |
665 | 665 | * // wikipedia_url: 'http: * //en.wikipedia.org/wiki/United_States' |
666 | 666 | * // }, |
667 | | - * // salience: 13.947371, |
| 667 | + * // salience: 0.13947371, |
668 | 668 | * // mentions: [ |
669 | 669 | * // { |
670 | 670 | * // text: { |
@@ -721,8 +721,8 @@ Document.prototype.detectEntities = function(options, callback) { |
721 | 721 | * results. Default: `false` |
722 | 722 | * @param {function} callback - The callback function. |
723 | 723 | * @param {?error} callback.err - An error occurred while making this request. |
724 | | - * @param {number} callback.sentiment - A value in the range of `-100` to `100`. |
725 | | - * Large numbers represent more positive sentiments. |
| 724 | + * @param {number} callback.sentiment - A value in the range of `-1` (negative) |
| 725 | + * to `1` (positive). |
726 | 726 | * @param {object} callback.apiResponse - The full API response. |
727 | 727 | * |
728 | 728 | * @example |
@@ -731,7 +731,7 @@ Document.prototype.detectEntities = function(options, callback) { |
731 | 731 | * // Error handling omitted. |
732 | 732 | * } |
733 | 733 | * |
734 | | - * // sentiment = 100 |
| 734 | + * // sentiment = 1 |
735 | 735 | * }); |
736 | 736 | * |
737 | 737 | * //- |
@@ -747,7 +747,7 @@ Document.prototype.detectEntities = function(options, callback) { |
747 | 747 | * } |
748 | 748 | * |
749 | 749 | * // sentiment = { |
750 | | - * // score: 100, |
| 750 | + * // score: 1, |
751 | 751 | * // magnitude: 4, |
752 | 752 | * // sentences: [ |
753 | 753 | * // { |
@@ -894,7 +894,7 @@ Document.prototype.detectSentiment = function(options, callback) { |
894 | 894 | * // beginOffset: -1 |
895 | 895 | * // }, |
896 | 896 | * // sentiment: { |
897 | | - * // score: 100 |
| 897 | + * // score: 1 |
898 | 898 | * // magnitude: 4 |
899 | 899 | * // } |
900 | 900 | * // } |
@@ -997,8 +997,6 @@ Document.formatEntities_ = function(entities, verbose) { |
997 | 997 |
|
998 | 998 | var groupName = GROUP_NAME_TO_TYPE[entity.type]; |
999 | 999 |
|
1000 | | - entity.salience *= 100; |
1001 | | - |
1002 | 1000 | acc[groupName] = arrify(acc[groupName]); |
1003 | 1001 | acc[groupName].push(entity); |
1004 | 1002 | acc[groupName].sort(Document.sortByProperty_('salience')); |
@@ -1047,12 +1045,12 @@ Document.formatSentences_ = function(sentences, verbose) { |
1047 | 1045 | * API. |
1048 | 1046 | * @param {boolean} verbose - Enable verbose mode for more detailed results. |
1049 | 1047 | * @return {number|object} - The sentiment represented as a number in the range |
1050 | | - * of `-100` to `100` or an object containing `score` and `magnitude` |
| 1048 | + * of `-1` to `1` or an object containing `score` and `magnitude` |
1051 | 1049 | * measurements in verbose mode. |
1052 | 1050 | */ |
1053 | 1051 | Document.formatSentiment_ = function(sentiment, verbose) { |
1054 | 1052 | sentiment = { |
1055 | | - score: sentiment.score *= 100, |
| 1053 | + score: sentiment.score, |
1056 | 1054 | magnitude: sentiment.magnitude |
1057 | 1055 | }; |
1058 | 1056 |
|
|