You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/05/27 14:42:54 UTC

[GitHub] [beam] kamilwu commented on a change in pull request #11776: [BEAM-9421] Better documentation of output results from AnnotateText transform

kamilwu commented on a change in pull request #11776:
URL: https://github.com/apache/beam/pull/11776#discussion_r431191464



##########
File path: sdks/python/apache_beam/examples/snippets/snippets.py
##########
@@ -1520,3 +1528,90 @@ def bigqueryio_deadletter():
   # [END BigQueryIODeadLetter]
 
   return result
+
+
+def extract_sentiments(response):
+  # [START nlp_extract_sentiments]
+  return {
+      'sentences': [{
+          sentence.text.content: sentence.sentiment.score
+      } for sentence in response.sentences],
+      'document_sentiment': response.document_sentiment.score,
+  }
+

Review comment:
       Done, thanks.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org