{ "auth": { "oauth2": { "scopes": { "https://www.googleapis.com/auth/cloud-language": { "description": "Apply machine learning models to reveal the structure and meaning of text" }, "https://www.googleapis.com/auth/cloud-platform": { "description": "See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account." } } } }, "basePath": "", "baseUrl": "https://language.googleapis.com/", "batchPath": "batch", "canonicalName": "Cloud Natural Language", "description": "Provides natural language understanding technologies, such as sentiment analysis, entity recognition, entity sentiment analysis, and other text annotations, to developers.", "discoveryVersion": "v1", "documentationLink": "https://cloud.google.com/natural-language/", "fullyEncodeReservedExpansion": true, "icons": { "x16": "http://www.google.com/images/icons/product/search-16.gif", "x32": "http://www.google.com/images/icons/product/search-32.gif" }, "id": "language:v2", "kind": "discovery#restDescription", "mtlsRootUrl": "https://language.mtls.googleapis.com/", "name": "language", "ownerDomain": "google.com", "ownerName": "Google", "parameters": { "$.xgafv": { "description": "V1 error format.", "enum": [ "1", "2" ], "enumDescriptions": [ "v1 error format", "v2 error format" ], "location": "query", "type": "string" }, "access_token": { "description": "OAuth access token.", "location": "query", "type": "string" }, "alt": { "default": "json", "description": "Data format for response.", "enum": [ "json", "media", "proto" ], "enumDescriptions": [ "Responses with Content-Type of application/json", "Media download with context-dependent Content-Type", "Responses with Content-Type of application/x-protobuf" ], "location": "query", "type": "string" }, "callback": { "description": "JSONP", "location": "query", "type": "string" }, "fields": { "description": "Selector specifying which fields to include in a partial response.", "location": "query", "type": "string" }, "key": { "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", "location": "query", "type": "string" }, "oauth_token": { "description": "OAuth 2.0 token for the current user.", "location": "query", "type": "string" }, "prettyPrint": { "default": "true", "description": "Returns response with indentations and line breaks.", "location": "query", "type": "boolean" }, "quotaUser": { "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", "location": "query", "type": "string" }, "uploadType": { "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", "location": "query", "type": "string" }, "upload_protocol": { "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", "location": "query", "type": "string" } }, "protocol": "rest", "resources": { "documents": { "methods": { "analyzeEntities": { "description": "Finds named entities (currently proper names and common nouns) in the text along with entity types, probability, mentions for each entity, and other properties.", "flatPath": "v2/documents:analyzeEntities", "httpMethod": "POST", "id": "language.documents.analyzeEntities", "parameterOrder": [], "parameters": {}, "path": "v2/documents:analyzeEntities", "request": { "$ref": "AnalyzeEntitiesRequest" }, "response": { "$ref": "AnalyzeEntitiesResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-language", "https://www.googleapis.com/auth/cloud-platform" ] }, "analyzeSentiment": { "description": "Analyzes the sentiment of the provided text.", "flatPath": "v2/documents:analyzeSentiment", "httpMethod": "POST", "id": "language.documents.analyzeSentiment", "parameterOrder": [], "parameters": {}, "path": "v2/documents:analyzeSentiment", "request": { "$ref": "AnalyzeSentimentRequest" }, "response": { "$ref": "AnalyzeSentimentResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-language", "https://www.googleapis.com/auth/cloud-platform" ] }, "annotateText": { "description": "A convenience method that provides all features in one call.", "flatPath": "v2/documents:annotateText", "httpMethod": "POST", "id": "language.documents.annotateText", "parameterOrder": [], "parameters": {}, "path": "v2/documents:annotateText", "request": { "$ref": "AnnotateTextRequest" }, "response": { "$ref": "AnnotateTextResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-language", "https://www.googleapis.com/auth/cloud-platform" ] }, "classifyText": { "description": "Classifies a document into categories.", "flatPath": "v2/documents:classifyText", "httpMethod": "POST", "id": "language.documents.classifyText", "parameterOrder": [], "parameters": {}, "path": "v2/documents:classifyText", "request": { "$ref": "ClassifyTextRequest" }, "response": { "$ref": "ClassifyTextResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-language", "https://www.googleapis.com/auth/cloud-platform" ] }, "moderateText": { "description": "Moderates a document for harmful and sensitive categories.", "flatPath": "v2/documents:moderateText", "httpMethod": "POST", "id": "language.documents.moderateText", "parameterOrder": [], "parameters": {}, "path": "v2/documents:moderateText", "request": { "$ref": "ModerateTextRequest" }, "response": { "$ref": "ModerateTextResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-language", "https://www.googleapis.com/auth/cloud-platform" ] } } } }, "revision": "20230812", "rootUrl": "https://language.googleapis.com/", "schemas": { "AnalyzeEntitiesRequest": { "description": "The entity analysis request message.", "id": "AnalyzeEntitiesRequest", "properties": { "document": { "$ref": "Document", "description": "Required. Input document." }, "encodingType": { "description": "The encoding type used by the API to calculate offsets.", "enum": [ "NONE", "UTF8", "UTF16", "UTF32" ], "enumDescriptions": [ "If `EncodingType` is not specified, encoding-dependent information (such as `begin_offset`) will be set at `-1`.", "Encoding-dependent information (such as `begin_offset`) is calculated based on the UTF-8 encoding of the input. C++ and Go are examples of languages that use this encoding natively.", "Encoding-dependent information (such as `begin_offset`) is calculated based on the UTF-16 encoding of the input. Java and JavaScript are examples of languages that use this encoding natively.", "Encoding-dependent information (such as `begin_offset`) is calculated based on the UTF-32 encoding of the input. Python is an example of a language that uses this encoding natively." ], "type": "string" } }, "type": "object" }, "AnalyzeEntitiesResponse": { "description": "The entity analysis response message.", "id": "AnalyzeEntitiesResponse", "properties": { "entities": { "description": "The recognized entities in the input document.", "items": { "$ref": "Entity" }, "type": "array" }, "languageCode": { "description": "The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language field for more details.", "type": "string" }, "languageSupported": { "description": "Whether the language is officially supported. The API may still return a response when the language is not supported, but it is on a best effort basis.", "type": "boolean" } }, "type": "object" }, "AnalyzeSentimentRequest": { "description": "The sentiment analysis request message.", "id": "AnalyzeSentimentRequest", "properties": { "document": { "$ref": "Document", "description": "Required. Input document." }, "encodingType": { "description": "The encoding type used by the API to calculate sentence offsets.", "enum": [ "NONE", "UTF8", "UTF16", "UTF32" ], "enumDescriptions": [ "If `EncodingType` is not specified, encoding-dependent information (such as `begin_offset`) will be set at `-1`.", "Encoding-dependent information (such as `begin_offset`) is calculated based on the UTF-8 encoding of the input. C++ and Go are examples of languages that use this encoding natively.", "Encoding-dependent information (such as `begin_offset`) is calculated based on the UTF-16 encoding of the input. Java and JavaScript are examples of languages that use this encoding natively.", "Encoding-dependent information (such as `begin_offset`) is calculated based on the UTF-32 encoding of the input. Python is an example of a language that uses this encoding natively." ], "type": "string" } }, "type": "object" }, "AnalyzeSentimentResponse": { "description": "The sentiment analysis response message.", "id": "AnalyzeSentimentResponse", "properties": { "documentSentiment": { "$ref": "Sentiment", "description": "The overall sentiment of the input document." }, "languageCode": { "description": "The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language field for more details.", "type": "string" }, "languageSupported": { "description": "Whether the language is officially supported. The API may still return a response when the language is not supported, but it is on a best effort basis.", "type": "boolean" }, "sentences": { "description": "The sentiment for all the sentences in the document.", "items": { "$ref": "Sentence" }, "type": "array" } }, "type": "object" }, "AnnotateTextRequest": { "description": "The request message for the text annotation API, which can perform multiple analysis types in one call.", "id": "AnnotateTextRequest", "properties": { "document": { "$ref": "Document", "description": "Required. Input document." }, "encodingType": { "description": "The encoding type used by the API to calculate offsets.", "enum": [ "NONE", "UTF8", "UTF16", "UTF32" ], "enumDescriptions": [ "If `EncodingType` is not specified, encoding-dependent information (such as `begin_offset`) will be set at `-1`.", "Encoding-dependent information (such as `begin_offset`) is calculated based on the UTF-8 encoding of the input. C++ and Go are examples of languages that use this encoding natively.", "Encoding-dependent information (such as `begin_offset`) is calculated based on the UTF-16 encoding of the input. Java and JavaScript are examples of languages that use this encoding natively.", "Encoding-dependent information (such as `begin_offset`) is calculated based on the UTF-32 encoding of the input. Python is an example of a language that uses this encoding natively." ], "type": "string" }, "features": { "$ref": "Features", "description": "Required. The enabled features." } }, "type": "object" }, "AnnotateTextResponse": { "description": "The text annotations response message.", "id": "AnnotateTextResponse", "properties": { "categories": { "description": "Categories identified in the input document.", "items": { "$ref": "ClassificationCategory" }, "type": "array" }, "documentSentiment": { "$ref": "Sentiment", "description": "The overall sentiment for the document. Populated if the user enables AnnotateTextRequest.Features.extract_document_sentiment." }, "entities": { "description": "Entities, along with their semantic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_entities or AnnotateTextRequest.Features.extract_entity_sentiment.", "items": { "$ref": "Entity" }, "type": "array" }, "languageCode": { "description": "The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language field for more details.", "type": "string" }, "languageSupported": { "description": "Whether the language is officially supported by all requested features. The API may still return a response when the language is not supported, but it is on a best effort basis.", "type": "boolean" }, "moderationCategories": { "description": "Harmful and sensitive categories identified in the input document.", "items": { "$ref": "ClassificationCategory" }, "type": "array" }, "sentences": { "description": "Sentences in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_document_sentiment.", "items": { "$ref": "Sentence" }, "type": "array" } }, "type": "object" }, "ClassificationCategory": { "description": "Represents a category returned from the text classifier.", "id": "ClassificationCategory", "properties": { "confidence": { "description": "The classifier's confidence of the category. Number represents how certain the classifier is that this category represents the given text.", "format": "float", "type": "number" }, "name": { "description": "The name of the category representing the document.", "type": "string" } }, "type": "object" }, "ClassifyTextRequest": { "description": "The document classification request message.", "id": "ClassifyTextRequest", "properties": { "document": { "$ref": "Document", "description": "Required. Input document." } }, "type": "object" }, "ClassifyTextResponse": { "description": "The document classification response message.", "id": "ClassifyTextResponse", "properties": { "categories": { "description": "Categories representing the input document.", "items": { "$ref": "ClassificationCategory" }, "type": "array" }, "languageCode": { "description": "The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language field for more details.", "type": "string" }, "languageSupported": { "description": "Whether the language is officially supported. The API may still return a response when the language is not supported, but it is on a best effort basis.", "type": "boolean" } }, "type": "object" }, "Document": { "description": "Represents the input to API methods.", "id": "Document", "properties": { "content": { "description": "The content of the input in string format. Cloud audit logging exempt since it is based on user data.", "type": "string" }, "gcsContentUri": { "description": "The Google Cloud Storage URI where the file content is located. This URI must be of the form: gs://bucket_name/object_name. For more details, see https://cloud.google.com/storage/docs/reference-uris. NOTE: Cloud Storage object versioning is not supported.", "type": "string" }, "languageCode": { "description": "Optional. The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. [Language Support](https://cloud.google.com/natural-language/docs/languages) lists currently supported languages for each API method. If the language (either specified by the caller or automatically detected) is not supported by the called API method, an `INVALID_ARGUMENT` error is returned.", "type": "string" }, "type": { "description": "Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.", "enum": [ "TYPE_UNSPECIFIED", "PLAIN_TEXT", "HTML" ], "enumDescriptions": [ "The content type is not specified.", "Plain text", "HTML" ], "type": "string" } }, "type": "object" }, "Entity": { "description": "Represents a phrase in the text that is a known entity, such as a person, an organization, or location. The API associates information, such as probability and mentions, with entities.", "id": "Entity", "properties": { "mentions": { "description": "The mentions of this entity in the input document. The API currently supports proper noun mentions.", "items": { "$ref": "EntityMention" }, "type": "array" }, "metadata": { "additionalProperties": { "type": "string" }, "description": "Metadata associated with the entity. For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`), if they are available. For the metadata associated with other entity types, see the Type table below.", "type": "object" }, "name": { "description": "The representative name for the entity.", "type": "string" }, "sentiment": { "$ref": "Sentiment", "description": "For calls to AnalyzeEntitySentiment or if AnnotateTextRequest.Features.extract_entity_sentiment is set to true, this field will contain the aggregate sentiment expressed for this entity in the provided document." }, "type": { "description": "The entity type.", "enum": [ "UNKNOWN", "PERSON", "LOCATION", "ORGANIZATION", "EVENT", "WORK_OF_ART", "CONSUMER_GOOD", "OTHER", "PHONE_NUMBER", "ADDRESS", "DATE", "NUMBER", "PRICE" ], "enumDescriptions": [ "Unknown", "Person", "Location", "Organization", "Event", "Artwork", "Consumer product", "Other types of entities", "Phone number The metadata lists the phone number, formatted according to local convention, plus whichever additional elements appear in the text: * `number` - the actual number, broken down into sections as per local convention * `national_prefix` - country code, if detected * `area_code` - region or area code, if detected * `extension` - phone extension (to be dialed after connection), if detected", "Address The metadata identifies the street number and locality plus whichever additional elements appear in the text: * `street_number` - street number * `locality` - city or town * `street_name` - street/route name, if detected * `postal_code` - postal code, if detected * `country` - country, if detected< * `broad_region` - administrative area, such as the state, if detected * `narrow_region` - smaller administrative area, such as county, if detected * `sublocality` - used in Asian addresses to demark a district within a city, if detected", "Date The metadata identifies the components of the date: * `year` - four digit year, if detected * `month` - two digit month number, if detected * `day` - two digit day number, if detected", "Number The metadata is the number itself.", "Price The metadata identifies the `value` and `currency`." ], "type": "string" } }, "type": "object" }, "EntityMention": { "description": "Represents a mention for an entity in the text. Currently, proper noun mentions are supported.", "id": "EntityMention", "properties": { "probability": { "description": "Probability score associated with the entity. The score shows the probability of the entity mention being the entity type. The score is in (0, 1] range.", "format": "float", "type": "number" }, "sentiment": { "$ref": "Sentiment", "description": "For calls to AnalyzeEntitySentiment or if AnnotateTextRequest.Features.extract_entity_sentiment is set to true, this field will contain the sentiment expressed for this mention of the entity in the provided document." }, "text": { "$ref": "TextSpan", "description": "The mention text." }, "type": { "description": "The type of the entity mention.", "enum": [ "TYPE_UNKNOWN", "PROPER", "COMMON" ], "enumDescriptions": [ "Unknown", "Proper name", "Common noun (or noun compound)" ], "type": "string" } }, "type": "object" }, "Features": { "description": "All available features. Setting each one to true will enable that specific analysis for the input.", "id": "Features", "properties": { "classifyText": { "description": "Optional. Classify the full document into categories.", "type": "boolean" }, "extractDocumentSentiment": { "description": "Optional. Extract document-level sentiment.", "type": "boolean" }, "extractEntities": { "description": "Optional. Extract entities.", "type": "boolean" }, "moderateText": { "description": "Optional. Moderate the document for harmful and sensitive categories.", "type": "boolean" } }, "type": "object" }, "ModerateTextRequest": { "description": "The document moderation request message.", "id": "ModerateTextRequest", "properties": { "document": { "$ref": "Document", "description": "Required. Input document." } }, "type": "object" }, "ModerateTextResponse": { "description": "The document moderation response message.", "id": "ModerateTextResponse", "properties": { "languageCode": { "description": "The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language field for more details.", "type": "string" }, "languageSupported": { "description": "Whether the language is officially supported. The API may still return a response when the language is not supported, but it is on a best effort basis.", "type": "boolean" }, "moderationCategories": { "description": "Harmful and sensitive categories representing the input document.", "items": { "$ref": "ClassificationCategory" }, "type": "array" } }, "type": "object" }, "Sentence": { "description": "Represents a sentence in the input document.", "id": "Sentence", "properties": { "sentiment": { "$ref": "Sentiment", "description": "For calls to AnalyzeSentiment or if AnnotateTextRequest.Features.extract_document_sentiment is set to true, this field will contain the sentiment for the sentence." }, "text": { "$ref": "TextSpan", "description": "The sentence text." } }, "type": "object" }, "Sentiment": { "description": "Represents the feeling associated with the entire text or entities in the text.", "id": "Sentiment", "properties": { "magnitude": { "description": "A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).", "format": "float", "type": "number" }, "score": { "description": "Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).", "format": "float", "type": "number" } }, "type": "object" }, "Status": { "description": "The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).", "id": "Status", "properties": { "code": { "description": "The status code, which should be an enum value of google.rpc.Code.", "format": "int32", "type": "integer" }, "details": { "description": "A list of messages that carry the error details. There is a common set of message types for APIs to use.", "items": { "additionalProperties": { "description": "Properties of the object. Contains field @type with type URL.", "type": "any" }, "type": "object" }, "type": "array" }, "message": { "description": "A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.", "type": "string" } }, "type": "object" }, "TextSpan": { "description": "Represents a text span in the input document.", "id": "TextSpan", "properties": { "beginOffset": { "description": "The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request.", "format": "int32", "type": "integer" }, "content": { "description": "The content of the text span, which is a substring of the document.", "type": "string" } }, "type": "object" } }, "servicePath": "", "title": "Cloud Natural Language API", "version": "v2", "version_module": true }