Skip to content

Add Cloud Client NL API samples. - #668

Merged
theacodes merged 3 commits into
masterfrom
language-samples
Dec 6, 2016
Merged

Add Cloud Client NL API samples.#668
theacodes merged 3 commits into
masterfrom
language-samples

Conversation

@jmdobry

Copy link
Copy Markdown
Member

No description provided.

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

Copy link
Copy Markdown
MemberAuthor

Blocked by googleapis/google-cloud-python#2747

Comment threadlanguage/cloud-client/snippets.py Outdated

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

Copy link
Copy Markdown
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
Copy Markdown
MemberAuthor

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
Copy Markdown
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
Copy Markdown
MemberAuthor

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

@gguussgguuss left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
MemberAuthor

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
Copy Markdown
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
Copy Markdown
MemberAuthor

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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/Polarity/Score

Comment threadlanguage/cloud-client/snippets.py Outdated
# document.doc_type == language.Document.HTML
sentiment = document.analyze_sentiment()

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

Copy link
Copy Markdown
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
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Done.

@jmdobry
jmdobryforce-pushed the language-samples branch 2 times, most recently from 7933caf to 2a15659CompareDecember 6, 2016 18:23
@jmdobry

Copy link
Copy Markdown
MemberAuthor

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

@googlebotgooglebot 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 masterDec 6, 2016
@theacodes
theacodes deleted the language-samples branch December 6, 2016 21:20
@jmdobryjmdobry 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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@jmdobry@theacodes@gguuss@googlebot