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 05:26:55 UTC

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

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



##########
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:
       Could you remove trailing empty lines?




----------------------------------------------------------------
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