1 | <?php
|
---|
2 | /*
|
---|
3 | * Copyright 2014 Google Inc.
|
---|
4 | *
|
---|
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
7 | * the License at
|
---|
8 | *
|
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 | *
|
---|
11 | * Unless required by applicable law or agreed to in writing, software
|
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
---|
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
14 | * License for the specific language governing permissions and limitations under
|
---|
15 | * the License.
|
---|
16 | */
|
---|
17 |
|
---|
18 | namespace Google\Service\CloudNaturalLanguage\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\CloudNaturalLanguage\AnalyzeEntitiesRequest;
|
---|
21 | use Google\Service\CloudNaturalLanguage\AnalyzeEntitiesResponse;
|
---|
22 | use Google\Service\CloudNaturalLanguage\AnalyzeSentimentRequest;
|
---|
23 | use Google\Service\CloudNaturalLanguage\AnalyzeSentimentResponse;
|
---|
24 | use Google\Service\CloudNaturalLanguage\AnnotateTextRequest;
|
---|
25 | use Google\Service\CloudNaturalLanguage\AnnotateTextResponse;
|
---|
26 | use Google\Service\CloudNaturalLanguage\ClassifyTextRequest;
|
---|
27 | use Google\Service\CloudNaturalLanguage\ClassifyTextResponse;
|
---|
28 | use Google\Service\CloudNaturalLanguage\ModerateTextRequest;
|
---|
29 | use Google\Service\CloudNaturalLanguage\ModerateTextResponse;
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * The "documents" collection of methods.
|
---|
33 | * Typical usage is:
|
---|
34 | * <code>
|
---|
35 | * $languageService = new Google\Service\CloudNaturalLanguage(...);
|
---|
36 | * $documents = $languageService->documents;
|
---|
37 | * </code>
|
---|
38 | */
|
---|
39 | class Documents extends \Google\Service\Resource
|
---|
40 | {
|
---|
41 | /**
|
---|
42 | * Finds named entities (currently proper names and common nouns) in the text
|
---|
43 | * along with entity types, probability, mentions for each entity, and other
|
---|
44 | * properties. (documents.analyzeEntities)
|
---|
45 | *
|
---|
46 | * @param AnalyzeEntitiesRequest $postBody
|
---|
47 | * @param array $optParams Optional parameters.
|
---|
48 | * @return AnalyzeEntitiesResponse
|
---|
49 | * @throws \Google\Service\Exception
|
---|
50 | */
|
---|
51 | public function analyzeEntities(AnalyzeEntitiesRequest $postBody, $optParams = [])
|
---|
52 | {
|
---|
53 | $params = ['postBody' => $postBody];
|
---|
54 | $params = array_merge($params, $optParams);
|
---|
55 | return $this->call('analyzeEntities', [$params], AnalyzeEntitiesResponse::class);
|
---|
56 | }
|
---|
57 | /**
|
---|
58 | * Analyzes the sentiment of the provided text. (documents.analyzeSentiment)
|
---|
59 | *
|
---|
60 | * @param AnalyzeSentimentRequest $postBody
|
---|
61 | * @param array $optParams Optional parameters.
|
---|
62 | * @return AnalyzeSentimentResponse
|
---|
63 | * @throws \Google\Service\Exception
|
---|
64 | */
|
---|
65 | public function analyzeSentiment(AnalyzeSentimentRequest $postBody, $optParams = [])
|
---|
66 | {
|
---|
67 | $params = ['postBody' => $postBody];
|
---|
68 | $params = array_merge($params, $optParams);
|
---|
69 | return $this->call('analyzeSentiment', [$params], AnalyzeSentimentResponse::class);
|
---|
70 | }
|
---|
71 | /**
|
---|
72 | * A convenience method that provides all features in one call.
|
---|
73 | * (documents.annotateText)
|
---|
74 | *
|
---|
75 | * @param AnnotateTextRequest $postBody
|
---|
76 | * @param array $optParams Optional parameters.
|
---|
77 | * @return AnnotateTextResponse
|
---|
78 | * @throws \Google\Service\Exception
|
---|
79 | */
|
---|
80 | public function annotateText(AnnotateTextRequest $postBody, $optParams = [])
|
---|
81 | {
|
---|
82 | $params = ['postBody' => $postBody];
|
---|
83 | $params = array_merge($params, $optParams);
|
---|
84 | return $this->call('annotateText', [$params], AnnotateTextResponse::class);
|
---|
85 | }
|
---|
86 | /**
|
---|
87 | * Classifies a document into categories. (documents.classifyText)
|
---|
88 | *
|
---|
89 | * @param ClassifyTextRequest $postBody
|
---|
90 | * @param array $optParams Optional parameters.
|
---|
91 | * @return ClassifyTextResponse
|
---|
92 | * @throws \Google\Service\Exception
|
---|
93 | */
|
---|
94 | public function classifyText(ClassifyTextRequest $postBody, $optParams = [])
|
---|
95 | {
|
---|
96 | $params = ['postBody' => $postBody];
|
---|
97 | $params = array_merge($params, $optParams);
|
---|
98 | return $this->call('classifyText', [$params], ClassifyTextResponse::class);
|
---|
99 | }
|
---|
100 | /**
|
---|
101 | * Moderates a document for harmful and sensitive categories.
|
---|
102 | * (documents.moderateText)
|
---|
103 | *
|
---|
104 | * @param ModerateTextRequest $postBody
|
---|
105 | * @param array $optParams Optional parameters.
|
---|
106 | * @return ModerateTextResponse
|
---|
107 | * @throws \Google\Service\Exception
|
---|
108 | */
|
---|
109 | public function moderateText(ModerateTextRequest $postBody, $optParams = [])
|
---|
110 | {
|
---|
111 | $params = ['postBody' => $postBody];
|
---|
112 | $params = array_merge($params, $optParams);
|
---|
113 | return $this->call('moderateText', [$params], ModerateTextResponse::class);
|
---|
114 | }
|
---|
115 | }
|
---|
116 |
|
---|
117 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
118 | class_alias(Documents::class, 'Google_Service_CloudNaturalLanguage_Resource_Documents');
|
---|