Skip to content

Conversation

@ryanmats
Copy link
Contributor

No description provided.

@ryanmats ryanmats requested a review from bshaffer August 16, 2017 20:56
Copy link
Contributor

@bshaffer bshaffer left a comment

Choose a reason for hiding this comment

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

Some really basic stuff. Really the only requirement I have is to remove the unneeded dependencies.

Another main concern I have is whether we can simplify the output. The sample contains 30 lines of printing the response. This makes the real meat of the sample, the API call, harder to locate. If we can cut down so that printing the response is only ~10 lines, this is optimal.

If it's really important to show "mentions" in the output, as well as the other properties, then I'm ok with keeping the verbose printing. As long as we have a good reason.

"symfony/console": "^3.0",
"google/cloud-storage": "^1.0",
"symfony/yaml": "^3.2"
"symfony/yaml": "^3.2",
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove this, since you've gotten rid of the Yaml calls below.

"symfony/yaml": "^3.2",
"google/gax": "^0.21.2",
"grpc/grpc": "^v1.1.0",
"google/protobuf": "^v3.3.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

The dependency google/gax is managed by google/proto-client, and the dependencies grpc/grpc and google/protobuf are maintained by google/gax. So, we can remove these three dependencies. The only new one we need is google/proto-client.

if (array_key_exists('wikipedia_url', $entity['metadata'])) {
printf('Wikipedia URL: %s' . PHP_EOL, $entity['metadata']['wikipedia_url']);
}
if (array_key_exists('mid', $entity['metadata'])) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need to print every single possible property - maybe we should exclude this one? What do the other languages do? As a base line, for simplicity, we could leave out all "optional" properties.

printf('Entity Magnitude: %s' . PHP_EOL, $entity->getSentiment()->getMagnitude());
printf('Entity Score: %s' . PHP_EOL, $entity->getSentiment()->getScore());
printf('Mentions: ' . PHP_EOL);
foreach ($entity->getMentions() as $mention) {
Copy link
Contributor

Choose a reason for hiding this comment

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

dumb question - what is a mention? For simplicity, can we exclude printing them out every time, or do the other languages do this also?

@bshaffer bshaffer changed the title Updated existing Vision samples and added entity_sentiment samples Updated existing Language samples and added entity_sentiment samples Aug 18, 2017
@bshaffer
Copy link
Contributor

You will need to run composer update on PHP 5.6 in order to get rid of the dependency error on Travis. Once the tests pass this is good 2 go 👍 👍

@ryanmats
Copy link
Contributor Author

thanks Brent. Yeah - I noticed the Travis dependency error. Running into a small roadblock reverting back to PHP 5.6 with phpenv but hopefully I'll be able to fix it soon!

@ryanmats ryanmats merged commit 76c900c into master Aug 22, 2017
@ryanmats ryanmats deleted the language-1.1-features branch August 22, 2017 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants