sloria / perspective-api-client

Node.js client for the Perspective API
https://www.perspectiveapi.com
MIT License
28 stars 9 forks source link

AnalyzeComment object not working? #175

Open corbolt opened 3 years ago

corbolt commented 3 years ago

Hi,

I tried to call analyze() with an AnalyzeComment object instead of the variant analyze(text, { options }).

The request looked like this:

analyze({ comment: { text }, languages: ['en'], requestedAttributes: { 'TOXICITY': { scoreThreshold: 0.6 }, 'IDENTITY_ATTACK': { scoreThreshold: 0.6 }, 'INSULT': { scoreThreshold: 0.7 } } });

Here I don't get a complete response from the API:

What I get as a response is the following:

{ languages: [ 'en' ], detectedLanguages: [ 'ro', 'en' ] }

The attributeScores are missing here. What am I doing wrong?