Skip to content
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

Add Cloud Client NL API samples. #668

Merged
merged 3 commits into from
Dec 6, 2016
Merged

Add Cloud Client NL API samples. #668

merged 3 commits into from
Dec 6, 2016

Conversation

jmdobry
Copy link
Member

@jmdobry jmdobry commented Nov 17, 2016

No description provided.

@jmdobry jmdobry added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Nov 17, 2016
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 17, 2016
@jmdobry
Copy link
Member Author

jmdobry commented Nov 17, 2016

Blocked by googleapis/google-cloud-python#2747


for entity in entities:
print('=' * 20)
print(' name: %s' % (entity.name,))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use %,

also, you could do:

print('name: {:>10}'.format(entity.name))

https://pyformat.info/#string_pad_align

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, copied this from the google-cloud-python docs. Fixed.

@@ -0,0 +1,54 @@
# -*- coding: utf-8 -*-
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be needed (this file contains no extended unicode characters)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

gguuss
gguuss previously requested changes Dec 2, 2016
Copy link
Contributor

@gguuss gguuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you're still using polarity, please replace all instances with sentiment score.

def test_entities_file(cloud_config, capsys):
snippets.entities_file('gs://bucket/file.txt')
out, _ = capsys.readouterr()
assert 'Polarity: 1' in out
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Polarity/Score

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

def test_syntax_text(cloud_config, capsys):
snippets.syntax_text('Hello, world!')
out, _ = capsys.readouterr()
assert 'Polarity: 1' in out
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be score?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

def test_sentiment_text(cloud_config, capsys):
snippets.sentiment_text('Hello, world!')
out, _ = capsys.readouterr()
assert 'Polarity: 1' in out
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Polarity/Score

# document.doc_type == language.Document.HTML
sentiment = document.analyze_sentiment()

print('Polarity: {}'.format(sentiment.polarity))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace Polarity with Score

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@jmdobry jmdobry force-pushed the language-samples branch 2 times, most recently from 7933caf to 2a15659 Compare December 6, 2016 18:23
@jmdobry
Copy link
Member Author

jmdobry commented Dec 6, 2016

Ready for final review. Need test.txt uploaded to whatever storage bucket is used by this repo's tests.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 6, 2016
Change-Id: I1771171bafb5c8f808133f5d910175d7e69d2fbc
@theacodes theacodes merged commit 91412be into master Dec 6, 2016
@theacodes theacodes deleted the language-samples branch December 6, 2016 21:20
@jmdobry jmdobry removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Dec 7, 2016
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
parthea pushed a commit to googleapis/google-cloud-python that referenced this pull request Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants