Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ...
- // Format for Cloud Natural Language API
- const positiveDocument = {
- type: 'PLAIN_TEXT',
- content: positiveText,
- };
- const negativeDocument = {
- type: 'PLAIN_TEXT',
- content: negativeText,
- };
- // Call Cloud Natural Language API sentiment analyzer and console log results
- (async () => {
- const positiveResults = await client.analyzeSentiment({ document: positiveDocument });
- const negativeResults = await client.analyzeSentiment({ document: negativeDocument });
- console.log(positiveResults);
- console.log(negativeResults);
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement