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
18namespace Google\Service\CloudNaturalLanguage\Resource;
19
20use Google\Service\CloudNaturalLanguage\AnalyzeEntitiesRequest;
21use Google\Service\CloudNaturalLanguage\AnalyzeEntitiesResponse;
22use Google\Service\CloudNaturalLanguage\AnalyzeEntitySentimentRequest;
23use Google\Service\CloudNaturalLanguage\AnalyzeEntitySentimentResponse;
24use Google\Service\CloudNaturalLanguage\AnalyzeSentimentRequest;
25use Google\Service\CloudNaturalLanguage\AnalyzeSentimentResponse;
26use Google\Service\CloudNaturalLanguage\AnalyzeSyntaxRequest;
27use Google\Service\CloudNaturalLanguage\AnalyzeSyntaxResponse;
28use Google\Service\CloudNaturalLanguage\AnnotateTextRequest;
29use Google\Service\CloudNaturalLanguage\AnnotateTextResponse;
30use Google\Service\CloudNaturalLanguage\ClassifyTextRequest;
31use Google\Service\CloudNaturalLanguage\ClassifyTextResponse;
32
33/**
34 * The "documents" collection of methods.
35 * Typical usage is:
36 *  <code>
37 *   $languageService = new Google\Service\CloudNaturalLanguage(...);
38 *   $documents = $languageService->documents;
39 *  </code>
40 */
41class Documents extends \Google\Service\Resource
42{
43  /**
44   * Finds named entities (currently proper names and common nouns) in the text
45   * along with entity types, salience, mentions for each entity, and other
46   * properties. (documents.analyzeEntities)
47   *
48   * @param AnalyzeEntitiesRequest $postBody
49   * @param array $optParams Optional parameters.
50   * @return AnalyzeEntitiesResponse
51   */
52  public function analyzeEntities(AnalyzeEntitiesRequest $postBody, $optParams = [])
53  {
54    $params = ['postBody' => $postBody];
55    $params = array_merge($params, $optParams);
56    return $this->call('analyzeEntities', [$params], AnalyzeEntitiesResponse::class);
57  }
58  /**
59   * Finds entities, similar to AnalyzeEntities in the text and analyzes sentiment
60   * associated with each entity and its mentions.
61   * (documents.analyzeEntitySentiment)
62   *
63   * @param AnalyzeEntitySentimentRequest $postBody
64   * @param array $optParams Optional parameters.
65   * @return AnalyzeEntitySentimentResponse
66   */
67  public function analyzeEntitySentiment(AnalyzeEntitySentimentRequest $postBody, $optParams = [])
68  {
69    $params = ['postBody' => $postBody];
70    $params = array_merge($params, $optParams);
71    return $this->call('analyzeEntitySentiment', [$params], AnalyzeEntitySentimentResponse::class);
72  }
73  /**
74   * Analyzes the sentiment of the provided text. (documents.analyzeSentiment)
75   *
76   * @param AnalyzeSentimentRequest $postBody
77   * @param array $optParams Optional parameters.
78   * @return AnalyzeSentimentResponse
79   */
80  public function analyzeSentiment(AnalyzeSentimentRequest $postBody, $optParams = [])
81  {
82    $params = ['postBody' => $postBody];
83    $params = array_merge($params, $optParams);
84    return $this->call('analyzeSentiment', [$params], AnalyzeSentimentResponse::class);
85  }
86  /**
87   * Analyzes the syntax of the text and provides sentence boundaries and
88   * tokenization along with part of speech tags, dependency trees, and other
89   * properties. (documents.analyzeSyntax)
90   *
91   * @param AnalyzeSyntaxRequest $postBody
92   * @param array $optParams Optional parameters.
93   * @return AnalyzeSyntaxResponse
94   */
95  public function analyzeSyntax(AnalyzeSyntaxRequest $postBody, $optParams = [])
96  {
97    $params = ['postBody' => $postBody];
98    $params = array_merge($params, $optParams);
99    return $this->call('analyzeSyntax', [$params], AnalyzeSyntaxResponse::class);
100  }
101  /**
102   * A convenience method that provides all the features that analyzeSentiment,
103   * analyzeEntities, and analyzeSyntax provide in one call.
104   * (documents.annotateText)
105   *
106   * @param AnnotateTextRequest $postBody
107   * @param array $optParams Optional parameters.
108   * @return AnnotateTextResponse
109   */
110  public function annotateText(AnnotateTextRequest $postBody, $optParams = [])
111  {
112    $params = ['postBody' => $postBody];
113    $params = array_merge($params, $optParams);
114    return $this->call('annotateText', [$params], AnnotateTextResponse::class);
115  }
116  /**
117   * Classifies a document into categories. (documents.classifyText)
118   *
119   * @param ClassifyTextRequest $postBody
120   * @param array $optParams Optional parameters.
121   * @return ClassifyTextResponse
122   */
123  public function classifyText(ClassifyTextRequest $postBody, $optParams = [])
124  {
125    $params = ['postBody' => $postBody];
126    $params = array_merge($params, $optParams);
127    return $this->call('classifyText', [$params], ClassifyTextResponse::class);
128  }
129}
130
131// Adding a class alias for backwards compatibility with the previous class name.
132class_alias(Documents::class, 'Google_Service_CloudNaturalLanguage_Resource_Documents');
133