1
0
Fork 0
mirror of https://github.com/imjasonh/gcloud-help synced 2026-07-10 19:31:55 +00:00
gcloud-help/gcloud/beta/ml/language/analyze-sentiment
2022-03-01 04:29:52 +00:00

86 lines
3.3 KiB
Text

NAME
gcloud beta ml language analyze-sentiment - use Google Cloud Natural
Language API to identify sentiments in a text
SYNOPSIS
gcloud beta ml language analyze-sentiment
(--content=CONTENT | --content-file=CONTENT_FILE)
[--content-type=CONTENT_TYPE; default="plain-text"]
[--encoding-type=ENCODING_TYPE; default="utf8"] [--language=LANGUAGE]
[GCLOUD_WIDE_FLAG ...]
DESCRIPTION
(BETA) Sentiment Analysis inspects the given text and identifies the
prevailing emotional opinion within the text, especially to determine a
writer's attitude as positive, negative, or neutral.
Currently English, Spanish, Japanese, Chinese (Simplified and Traditional),
French, German, Italian, Korean, and Portuguese are supported.
EXAMPLES
To analyze sentiment in raw content 'I love puppies.':
$ gcloud beta ml language analyze-sentiment \
--content='I love puppies.'
To analyze sentiment in file 'myfile.txt':
$ gcloud beta ml language analyze-sentiment \
--content-file='myfile.txt'
To analyze sentiment in a remote file 'gs://bucket_name/mycontent.html' for
Japanese language using UTF-8 encoding:
$ gcloud beta ml language analyze-sentiment \
--content-file='gs://bucket_name/mycontent.html' \
--content-type=HTML --encoding-type=utf8 --language=ja-JP
REQUIRED FLAGS
Exactly one of these must be specified:
--content=CONTENT
Specify input text on the command line. Useful for experiments, or
for extremely short text.
--content-file=CONTENT_FILE
Specify a local file or Google Cloud Storage (format
gs://bucket/object) file path containing the text to be analyzed.
More useful for longer text or data output from another system.
OPTIONAL FLAGS
--content-type=CONTENT_TYPE; default="plain-text"
Specify the format of the input text. CONTENT_TYPE must be one of:
html, plain-text.
--encoding-type=ENCODING_TYPE; default="utf8"
The encoding type used by the API to calculate offsets. If set to none,
encoding-dependent offsets will be set at -1. This is an optional flag
only used for the entity mentions in results, and does not affect how
the input is read or analyzed. ENCODING_TYPE must be one of: none,
utf16, utf32, utf8.
--language=LANGUAGE
Specify the language of the input text. If omitted, the server will
attempt to auto-detect. Both ISO (such as en or es) and BCP-47 (such as
en-US or ja-JP) language codes are accepted.
GCLOUD WIDE FLAGS
These flags are available to all commands: --access-token-file, --account,
--billing-project, --configuration, --flags-file, --flatten, --format,
--help, --impersonate-service-account, --log-http, --project, --quiet,
--trace-token, --user-output-enabled, --verbosity.
Run $ gcloud help for details.
API REFERENCE
This command uses the language/v1beta2 API. The full documentation for this
API can be found at: https://cloud.google.com/natural-language/
NOTES
This command is currently in beta and might change without notice. These
variants are also available:
$ gcloud ml language analyze-sentiment
$ gcloud alpha ml language analyze-sentiment