Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. // ...
  2.  
  3. // Format for Cloud Natural Language API
  4. const positiveDocument = {
  5. type: 'PLAIN_TEXT',
  6. content: positiveText,
  7. };
  8.  
  9. const negativeDocument = {
  10. type: 'PLAIN_TEXT',
  11. content: negativeText,
  12. };
  13.  
  14. // Call Cloud Natural Language API sentiment analyzer and console log results
  15. (async () => {
  16. const positiveResults = await client.analyzeSentiment({ document: positiveDocument });
  17. const negativeResults = await client.analyzeSentiment({ document: negativeDocument });
  18. console.log(positiveResults);
  19. console.log(negativeResults);
  20. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement