-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactored the Sentiment Analysis tutorial to use the Cloud Client Lib #713
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I'd like Puneith to take a look.
I think you mean @puneith |
ee8e194
to
6f5a1b4
Compare
This is unblocked and ready for final review |
6f5a1b4
to
8bca2aa
Compare
|
||
for i, sentence in enumerate(response['sentences']): | ||
sentence_sentiment = sentence['sentiment']['score'] | ||
for i, sentence in enumerate(annotations.sentences): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the variable name from "i" to "index"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Other than the earlier comment LGTM |
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>
.
|
FYI, it looks like flake8 is not liking a couple things:
|
8bca2aa
to
b805fe2
Compare
b805fe2
to
348ff53
Compare
Blocked by googleapis/google-cloud-python#2858