sloria / perspective-api-client

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

Language detection error #123

Open marialani opened 4 years ago

marialani commented 4 years ago

When the language is not automatically detected the perspective-api-client will throw the error: response error unable to detect language

The easiest workaround to this issue would be making sure to add a default option as suggested by the official documentation. I'd propose adding this following code example to the readme const result = await perspective.analyze({ comment: { text }, languages: ["en"], })

DevGorilla commented 3 years ago

There also needs to be something in getAnalyzeCommentPayload to the effect of if (opts.languages) resource.languages = opts.languages; I created a branch, but there are not push permissions aside from @sloria