Skip to content

Commit 7b46b37

Browse files
Accomodate Brent's comments.
1 parent e8b6e84 commit 7b46b37

8 files changed

+8
-28
lines changed

language/api/src/AnalyzeEntitiesCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use Symfony\Component\Console\Command\Command;
2121
use Symfony\Component\Console\Input\InputArgument;
2222
use Symfony\Component\Console\Input\InputInterface;
23-
use Symfony\Component\Console\Input\InputOption;
2423
use Symfony\Component\Console\Output\OutputInterface;
2524

2625
/**

language/api/src/AnalyzeEverythingCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use Symfony\Component\Console\Command\Command;
2121
use Symfony\Component\Console\Input\InputArgument;
2222
use Symfony\Component\Console\Input\InputInterface;
23-
use Symfony\Component\Console\Input\InputOption;
2423
use Symfony\Component\Console\Output\OutputInterface;
2524

2625
/**

language/api/src/AnalyzeSentimentCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use Symfony\Component\Console\Command\Command;
2121
use Symfony\Component\Console\Input\InputArgument;
2222
use Symfony\Component\Console\Input\InputInterface;
23-
use Symfony\Component\Console\Input\InputOption;
2423
use Symfony\Component\Console\Output\OutputInterface;
2524

2625
/**

language/api/src/AnalyzeSyntaxCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use Symfony\Component\Console\Command\Command;
2121
use Symfony\Component\Console\Input\InputArgument;
2222
use Symfony\Component\Console\Input\InputInterface;
23-
use Symfony\Component\Console\Input\InputOption;
2423
use Symfony\Component\Console\Output\OutputInterface;
2524

2625
/**

language/api/src/functions/analyze_entities.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,22 @@
2424
namespace Google\Cloud\Samples\Language;
2525

2626
# [START analyze_entities]
27-
use Google\Cloud\ServiceBuilder;
2827
use Google\Cloud\NaturalLanguage\NaturalLanguageClient;
2928
use Google\Cloud\NaturalLanguage\Annotation;
3029

3130
/**
3231
* Find the entities in text.
3332
* ```
34-
* analyze_entities($projectId, 'Do you know the way to San Jose?');
33+
* analyze_entities('Do you know the way to San Jose?');
3534
* ```.
3635
*
37-
* @param string $projectId The Google project ID.
3836
* @param string $text The text to analyze.
3937
*
4038
* @return Annotation
4139
*/
4240
function analyze_entities($text, $options = [])
4341
{
44-
$builder = new ServiceBuilder();
45-
/** @var NaturalLanguageClient $language */
46-
$language = $builder->naturalLanguage();
42+
$language = new NaturalLanguageClient();
4743
$annotation = $language->analyzeEntities($text);
4844
return $annotation;
4945
}

language/api/src/functions/analyze_everything.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,22 @@
2424
namespace Google\Cloud\Samples\Language;
2525

2626
# [START analyze_everything]
27-
use Google\Cloud\ServiceBuilder;
2827
use Google\Cloud\NaturalLanguage\NaturalLanguageClient;
2928
use Google\Cloud\NaturalLanguage\Annotation;
3029

3130
/**
3231
* Find the everything in text.
3332
* ```
34-
* analyze_everything($projectId, 'Do you know the way to San Jose?');
33+
* analyze_everything('Do you know the way to San Jose?');
3534
* ```.
3635
*
37-
* @param string $projectId The Google project ID.
3836
* @param string $text The text to analyze.
3937
*
4038
* @return Annotation
4139
*/
4240
function analyze_everything($text, $options = [])
4341
{
44-
$builder = new ServiceBuilder();
45-
/** @var NaturalLanguageClient $language */
46-
$language = $builder->naturalLanguage();
42+
$language = new NaturalLanguageClient();
4743
$annotation = $language->annotateText($text, [
4844
'features' => ['entities', 'syntax', 'sentiment']
4945
]);

language/api/src/functions/analyze_sentiment.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,22 @@
2424
namespace Google\Cloud\Samples\Language;
2525

2626
# [START analyze_sentiment]
27-
use Google\Cloud\ServiceBuilder;
2827
use Google\Cloud\NaturalLanguage\NaturalLanguageClient;
2928
use Google\Cloud\NaturalLanguage\Annotation;
3029

3130
/**
3231
* Find the sentiment in text.
3332
* ```
34-
* analyze_sentiment($projectId, 'Do you know the way to San Jose?');
33+
* analyze_sentiment('Do you know the way to San Jose?');
3534
* ```.
3635
*
37-
* @param string $projectId The Google project ID.
3836
* @param string $text The text to analyze.
3937
*
4038
* @return Annotation
4139
*/
4240
function analyze_sentiment($text, $options = [])
4341
{
44-
$builder = new ServiceBuilder();
45-
/** @var NaturalLanguageClient $language */
46-
$language = $builder->naturalLanguage();
42+
$language = new NaturalLanguageClient();
4743
$annotation = $language->analyzeSentiment($text);
4844
return $annotation;
4945
}

language/api/src/functions/analyze_syntax.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,22 @@
2424
namespace Google\Cloud\Samples\Language;
2525

2626
# [START analyze_syntax]
27-
use Google\Cloud\ServiceBuilder;
2827
use Google\Cloud\NaturalLanguage\NaturalLanguageClient;
2928
use Google\Cloud\NaturalLanguage\Annotation;
3029

3130
/**
3231
* Find the syntax in text.
3332
* ```
34-
* analyze_syntax($projectId, 'Do you know the way to San Jose?');
33+
* analyze_syntax('Do you know the way to San Jose?');
3534
* ```.
3635
*
37-
* @param string $projectId The Google project ID.
3836
* @param string $text The text to analyze.
3937
*
4038
* @return Annotation
4139
*/
4240
function analyze_syntax($text, $options = [])
4341
{
44-
$builder = new ServiceBuilder();
45-
/** @var NaturalLanguageClient $language */
46-
$language = $builder->naturalLanguage();
42+
$language = new NaturalLanguageClient();
4743
$annotation = $language->analyzeSyntax($text);
4844
return $annotation;
4945
}

0 commit comments

Comments
 (0)