Guest User

Untitled

a guest
Aug 27th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import settings . #store your API_USER and Password here.
  2. import json
  3. from watson_developer_cloud import NaturalLanguageUnderstandingV1
  4. import watson_developer_cloud.natural_language_understanding.features.v1 as Features
  5.  
  6. natural_language_understanding = NaturalLanguageUnderstandingV1(
  7. username=settings.API_USER_NAME,
  8. password=settings.API_PASSWORD,
  9. version="2017-02-27")
  10.  
  11. response = natural_language_understanding.analyze(
  12. text="you crap
  13. damn master",
  14. features=[
  15. Features.Entities(
  16. emotion=True,
  17. sentiment=True,
  18. limit=2
  19. ),
  20. Features.Keywords(
  21. emotion=True,
  22. sentiment=True,
  23. limit=2
  24. )
  25. ]
  26. )
  27.  
  28. print(json.dumps(response, indent=2))
Add Comment
Please, Sign In to add comment