diff --git a/google/cloud/language/v1beta2/language_service.proto b/google/cloud/language/v1beta2/language_service.proto index f79d0705..6ddea6dc 100644 --- a/google/cloud/language/v1beta2/language_service.proto +++ b/google/cloud/language/v1beta2/language_service.proto @@ -55,8 +55,13 @@ service LanguageService { option (google.api.http) = { post: "/v1beta2/documents:analyzeSyntax" body: "*" }; } - // A convenience method that provides all syntax, sentiment, and entity - // features in one call. + // Classifies a document into categories. + rpc ClassifyText(ClassifyTextRequest) returns (ClassifyTextResponse) { + option (google.api.http) = { post: "/v1beta2/documents:classifyText" body: "*" }; + } + + // A convenience method that provides all syntax, sentiment, entity, and + // classification features in one call. rpc AnnotateText(AnnotateTextRequest) returns (AnnotateTextResponse) { option (google.api.http) = { post: "/v1beta2/documents:annotateText" body: "*" }; } @@ -98,7 +103,7 @@ message Document { // 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) + // [Language Support](/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 @@ -820,6 +825,16 @@ message TextSpan { int32 begin_offset = 2; } +// Represents a category returned from the text classifier. +message ClassificationCategory { + // The name of the category representing the document. + string name = 1; + + // The classifier's confidence of the category. Number represents how certain + // the classifier is that this category represents the given text. + float confidence = 2; +} + // The sentiment analysis request message. message AnalyzeSentimentRequest { // Input document. @@ -907,6 +922,18 @@ message AnalyzeSyntaxResponse { string language = 3; } +// The document classification request message. +message ClassifyTextRequest { + // Input document. + Document document = 1; +} + +// The document classification response message. +message ClassifyTextResponse { + // Categories representing the input document. + repeated ClassificationCategory categories = 1; +} + // The request message for the text annotation API, which can perform multiple // analysis types (sentiment, entities, and syntax) in one call. message AnnotateTextRequest { @@ -924,6 +951,9 @@ message AnnotateTextRequest { // Extract entities and their associated sentiment. bool extract_entity_sentiment = 4; + + // Classify the full document into categories. + bool classify_text = 6; } // Input document. @@ -960,6 +990,9 @@ message AnnotateTextResponse { // in the request or, if not specified, the automatically-detected language. // See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. string language = 5; + + // Categories identified in the input document. + repeated ClassificationCategory categories = 6; } // Represents the text encoding that the caller uses to process the output.