annotateText() public method

public annotateText ( array $args = [] ) : array
$args array
return array
 /**
  * Analyzes the document and provides a full set of text annotations,
  * including semantic, syntactic, and sentiment information.
  *
  * Example:
  * ```
  * // Annotate text with all features enabled.
  * $annotation = $language->annotateText('Google Cloud Platform is a powerful tool.');
  * $sentiment = $annotation->sentiment();
  *
  * echo $sentiment['magnitude'];
  * ```
  *
  * ```
  * // Annotate text with syntax and sentiment features enabled.
  * $annotation = $language->annotateText('Google Cloud Platform is a powerful tool.', [
  *     'features' => ['syntax', 'sentiment']
  * ]);
  *
  * foreach ($annotation->tokens() as $token) {
  *     echo $token['text']['beginOffset'];
  * }
  * ```
  *
  * @codingStandardsIgnoreStart
  * @see https://cloud.google.com/natural-language/reference/rest/v1beta1/documents/annotateText Annotate Text API documentation
  * @codingStandardsIgnoreEnd
  *
  * @param string|StorageObject $content The content to annotate.
  * @param array $options [optional] {
  *     Configuration options.
  *
  *     @type array $features Features to apply to the request. Valid values
  *           are `syntax`, `sentiment`, and `entities`. If no features are
  *           provided the request will run with all three enabled.
  *     @type string $type The document type. Acceptable values are
  *           `PLAIN_TEXT` or `HTML`. **Defaults to** `"PLAIN_TEXT"`.
  *     @type string $language The language of the document. Both ISO
  *           (e.g., en, es) and BCP-47 (e.g., en-US, es-ES) language codes
  *           are accepted. If no value is provided, the language will be
  *           detected by the service.
  *     @type string $encodingType The text encoding type used by the API to
  *           calculate offsets. Acceptable values are `"NONE"`, `"UTF8"`,
  *           `"UTF16"` and `"UTF32"`. **Defaults to** `"UTF8"`.
  * }
  * @return Annotation
  */
 public function annotateText($content, array $options = [])
 {
     $features = isset($options['features']) ? $options['features'] : array_values($this->featureShortNames);
     $options['features'] = $this->normalizeFeatures($features);
     return new Annotation($this->connection->annotateText($this->formatRequest($content, $options)));
 }