Refactored the Sentiment Analysis tutorial to use the Cloud Client Lib#713
Merged
Refactored the Sentiment Analysis tutorial to use the Cloud Client Lib#713
Conversation
theacodes
approved these changes
Dec 12, 2016
Contributor
theacodes
left a comment
There was a problem hiding this comment.
LGTM, but I'd like Puneith to take a look.
Member
Author
|
I think you mean @puneith |
ee8e194 to
6f5a1b4
Compare
Member
Author
|
This is unblocked and ready for final review |
6f5a1b4 to
8bca2aa
Compare
gguuss
approved these changes
Dec 15, 2016
puneith
reviewed
Dec 15, 2016
|
|
||
| for i, sentence in enumerate(response['sentences']): | ||
| sentence_sentiment = sentence['sentiment']['score'] | ||
| for i, sentence in enumerate(annotations.sentences): |
Contributor
There was a problem hiding this comment.
change the variable name from "i" to "index"
Contributor
|
Other than the earlier comment LGTM |
Contributor
|
I'm okay with i, but "n" is idiomatic in combination with "enumerate".
…On Wed, Dec 14, 2016, 11:45 PM Puneith Kaul ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In language/sentiment/sentiment_analysis.py
<#713 (review)>
:
> - service_request = service.documents().analyzeSentiment(
- body={
- 'document': {
- 'type': 'PLAIN_TEXT',
- 'content': review_file.read(),
- }
- }
- )
- response = service_request.execute()
-
- score = response['documentSentiment']['score']
- magnitude = response['documentSentiment']['magnitude']
-
- for i, sentence in enumerate(response['sentences']):
- sentence_sentiment = sentence['sentiment']['score']
+ for i, sentence in enumerate(annotations.sentences):
change the variable name from "i" to "index"
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#713 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAPUc7DdGFUeyL7MQAKqDVcRqhcUm91Yks5rIPA0gaJpZM4LLHiM>
.
|
Contributor
|
FYI, it looks like flake8 is not liking a couple things: |
8bca2aa to
b805fe2
Compare
b805fe2 to
348ff53
Compare
hkdevandla
pushed a commit
to hkdevandla/python-language
that referenced
this pull request
Sep 26, 2020
busunkim96
pushed a commit
to googleapis/python-language
that referenced
this pull request
Sep 29, 2020
m-strzelczyk
pushed a commit
that referenced
this pull request
Nov 18, 2022
8 tasks
parthea
pushed a commit
to googleapis/google-cloud-python
that referenced
this pull request
Jul 6, 2023
Linchin
added a commit
that referenced
this pull request
Aug 18, 2025
* chore: Update gapic-generator-python to v1.12.0 PiperOrigin-RevId: 586356061 Source-Link: googleapis/googleapis@72a1f55 Source-Link: https://github.com/googleapis/googleapis-gen/commit/558a04bcd1cc0576e8fac1089e48e48b27ac161b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTU4YTA0YmNkMWNjMDU3NmU4ZmFjMTA4OWU0OGU0OGIyN2FjMTYxYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: added Generator API docs: updated doc for speech mode PiperOrigin-RevId: 586469693 Source-Link: googleapis/googleapis@e8148d6 Source-Link: https://github.com/googleapis/googleapis-gen/commit/85136bd04383ed7172bb18b7b8d220dd7ff6b3a0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODUxMzZiZDA0MzgzZWQ3MTcyYmIxOGI3YjhkMjIwZGQ3ZmY2YjNhMCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Lingqing Gan <lingqing.gan@gmail.com>
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Blocked by googleapis/google-cloud-python#2858