The Cloud Natural Language API v1beta1 version will be shut down on December 27, 2019. After this date, attempts to call the API will fail. You must upgrade to the v1 version of the API and client libraries before this date.
The notable implementation difference between the versions is the attributes of the Sentiment type.
- In v1beta1, the attributes were
"polarity"
and"magnitude"
, which were used together to calculate the sentiment score (how large the sentiment was) - In v1, the attributes are
"magnitude"
and"score"
, where the value of"score"
corresponds to the product of v1beta1's"polarity"
and"magnitude"
.
If your v1beta1 application uses "polarity"
, update it to use the sign of the
"score"
: the polarity is positive if the score is positive and negative if the
score is negative. If your application uses "polarity" * "magnitude"
, use
"score"
instead.