-
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
Add Cloud Client NL API samples. #668
Conversation
Blocked by googleapis/google-cloud-python#2747 |
|
||
for entity in entities: | ||
print('=' * 20) | ||
print(' name: %s' % (entity.name,)) |
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.
don't use %
,
also, you could do:
print('name: {:>10}'.format(entity.name))
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.
Oops, copied this from the google-cloud-python docs. Fixed.
@@ -0,0 +1,54 @@ | |||
# -*- coding: utf-8 -*- |
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.
This shouldn't be needed (this file contains no extended unicode characters)
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.
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.
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 |
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.
s/Polarity/Score
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.
def test_syntax_text(cloud_config, capsys): | ||
snippets.syntax_text('Hello, world!') | ||
out, _ = capsys.readouterr() | ||
assert 'Polarity: 1' in out |
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.
Should be score?
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.
def test_sentiment_text(cloud_config, capsys): | ||
snippets.sentiment_text('Hello, world!') | ||
out, _ = capsys.readouterr() | ||
assert 'Polarity: 1' in out |
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.
s/Polarity/Score
# document.doc_type == language.Document.HTML | ||
sentiment = document.analyze_sentiment() | ||
|
||
print('Polarity: {}'.format(sentiment.polarity)) |
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.
Replace Polarity with Score
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.
7933caf
to
2a15659
Compare
Ready for final review. Need |
786ee57
to
a06ce1b
Compare
No description provided.