gcloud alpha ml language classify-text

NAME
gcloud alpha ml language classify-text - classifies input document into categories
SYNOPSIS
gcloud alpha ml language classify-text(--content=CONTENT    |--content-file=CONTENT_FILE)[--content-type=CONTENT_TYPE; default="plain-text"][--language=LANGUAGE][GCLOUD_WIDE_FLAG]
DESCRIPTION
(ALPHA) Classifies input document into categories. Returns a listof categories representing the document. Only the most relevant categories adocument are returned e.g. if/Science and/Science/Astronomy both apply to a document, then only the/Science/Astronomy category is returned, as it is the more specificresult.

Currently only English is supported for this feature.

EXAMPLES
To classify text in raw content 'Long Political Text.':
gcloudalphamllanguageclassify-text--content='Long Political Text.'

To classify text in file 'myfile.txt':

gcloudalphamllanguageclassify-text--content-file='myfile.txt'

To classify text in a remote file 'gs://bucket_name/mycontent.html' for Japaneselanguage:

gcloudalphamllanguageclassify-text--content-file='gs://bucket_name/mycontent.html'--content-type=HTML--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 extremelyshort text.
--content-file=CONTENT_FILE
Specify a local file or Google Cloud Storage (formatgs://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 mustbe one of:html,plain-text.
--language=LANGUAGE
Specify the language of the input text. If omitted, the server will attempt toauto-detect. Both ISO (such asen ores) and BCP-47(such asen-US orja-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 thelanguage/v1beta2 API. The full documentationfor this API can be found at:https://cloud.google.com/natural-language/
NOTES
This command is currently in alpha and might change without notice. If thiscommand fails with API permission errors despite specifying the correct project,you might be trying to access an API with an invitation-only early accessallowlist. These variants are also available:
gcloudmllanguageclassify-text
gcloudbetamllanguageclassify-text

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-05-07 UTC.