-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Refactored the Sentiment Analysis tutorial to use the Cloud Client Lib #713
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
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
* 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>
Blocked by googleapis/google-cloud-python#2858