Guest User

Untitled

a guest
Dec 19th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. def nlp_text_manager(text_path, name):
  2. text = text_path
  3. txt = Path(text_path).read_text(encoding='cp1252')
  4. service = discovery.build('language', 'v1beta2', credentials=credentials)
  5. service_request = service.documents().analyzeSentiment(
  6. body={
  7. 'document': {
  8. 'type': 'PLAIN_TEXT',
  9. 'content': txt
  10. }
  11. }
  12. )
  13. response = service_request.execute()
  14. return response
Add Comment
Please, Sign In to add comment