1414
1515syntax = "proto3" ;
1616
17- package google.cloud.language.v1beta1 ;
17+ package google.cloud.language.v1 ;
1818
1919import "google/api/annotations.proto" ;
2020
21- option go_package = "google.golang.org/genproto/googleapis/cloud/language/v1beta1 ;language" ;
21+ option go_package = "google.golang.org/genproto/googleapis/cloud/language/v1 ;language" ;
2222option java_multiple_files = true ;
2323option java_outer_classname = "LanguageServiceProto" ;
24- option java_package = "com.google.cloud.language.v1beta1 " ;
24+ option java_package = "com.google.cloud.language.v1 " ;
2525
2626
2727// Provides text analysis operations such as sentiment analysis and entity
2828// recognition.
2929service LanguageService {
3030 // Analyzes the sentiment of the provided text.
3131 rpc AnalyzeSentiment (AnalyzeSentimentRequest ) returns (AnalyzeSentimentResponse ) {
32- option (google.api.http ) = { post : "/v1beta1 /documents:analyzeSentiment" body : "*" };
32+ option (google.api.http ) = { post : "/v1 /documents:analyzeSentiment" body : "*" };
3333 }
3434
3535 // Finds named entities (currently proper names and common nouns) in the text
3636 // along with entity types, salience, mentions for each entity, and
3737 // other properties.
3838 rpc AnalyzeEntities (AnalyzeEntitiesRequest ) returns (AnalyzeEntitiesResponse ) {
39- option (google.api.http ) = { post : "/v1beta1/documents:analyzeEntities" body : "*" };
39+ option (google.api.http ) = { post : "/v1/documents:analyzeEntities" body : "*" };
40+ }
41+
42+ // Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes
43+ // sentiment associated with each entity and its mentions.
44+ rpc AnalyzeEntitySentiment (AnalyzeEntitySentimentRequest ) returns (AnalyzeEntitySentimentResponse ) {
45+ option (google.api.http ) = { post : "/v1/documents:analyzeEntitySentiment" body : "*" };
4046 }
4147
4248 // Analyzes the syntax of the text and provides sentence boundaries and
4349 // tokenization along with part of speech tags, dependency trees, and other
4450 // properties.
4551 rpc AnalyzeSyntax (AnalyzeSyntaxRequest ) returns (AnalyzeSyntaxResponse ) {
46- option (google.api.http ) = { post : "/v1beta1/documents:analyzeSyntax" body : "*" };
52+ option (google.api.http ) = { post : "/v1/documents:analyzeSyntax" body : "*" };
53+ }
54+
55+ // Classifies a document into categories.
56+ rpc ClassifyText (ClassifyTextRequest ) returns (ClassifyTextResponse ) {
57+ option (google.api.http ) = { post : "/v1/documents:classifyText" body : "*" };
4758 }
4859
4960 // A convenience method that provides all the features that analyzeSentiment,
5061 // analyzeEntities, and analyzeSyntax provide in one call.
5162 rpc AnnotateText (AnnotateTextRequest ) returns (AnnotateTextResponse ) {
52- option (google.api.http ) = { post : "/v1beta1 /documents:annotateText" body : "*" };
63+ option (google.api.http ) = { post : "/v1 /documents:annotateText" body : "*" };
5364 }
5465}
5566
@@ -89,7 +100,7 @@ message Document {
89100 // The language of the document (if not specified, the language is
90101 // automatically detected). Both ISO and BCP-47 language codes are
91102 // accepted.<br>
92- // [Language Support](https://cloud.google.com /natural-language/docs/languages)
103+ // [Language Support](/natural-language/docs/languages)
93104 // lists currently supported languages for each API method.
94105 // If the language (either specified by the caller or automatically detected)
95106 // is not supported by the called API method, an `INVALID_ARGUMENT` error
@@ -103,7 +114,7 @@ message Sentence {
103114 TextSpan text = 1 ;
104115
105116 // For calls to [AnalyzeSentiment][] or if
106- // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta1 .AnnotateTextRequest.Features.extract_document_sentiment] is set to
117+ // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1 .AnnotateTextRequest.Features.extract_document_sentiment] is set to
107118 // true, this field will contain the sentiment for the sentence.
108119 Sentiment sentiment = 2 ;
109120}
@@ -162,6 +173,12 @@ message Entity {
162173 // The mentions of this entity in the input document. The API currently
163174 // supports proper noun mentions.
164175 repeated EntityMention mentions = 5 ;
176+
177+ // For calls to [AnalyzeEntitySentiment][] or if
178+ // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] is set to
179+ // true, this field will contain the aggregate sentiment expressed for this
180+ // entity in the provided document.
181+ Sentiment sentiment = 6 ;
165182}
166183
167184// Represents the smallest syntactic building block of the text.
@@ -182,11 +199,6 @@ message Token {
182199// Represents the feeling associated with the entire text or entities in
183200// the text.
184201message Sentiment {
185- // DEPRECATED FIELD - This field is being deprecated in
186- // favor of score. Please refer to our documentation at
187- // https://cloud.google.com/natural-language/docs for more information.
188- float polarity = 1 ;
189-
190202 // A non-negative number in the [0, +inf) range, which represents
191203 // the absolute magnitude of sentiment regardless of score (positive or
192204 // negative).
@@ -197,7 +209,9 @@ message Sentiment {
197209 float score = 3 ;
198210}
199211
200- // Represents part of speech information for a token.
212+ // Represents part of speech information for a token. Parts of speech
213+ // are as defined in
214+ // http://www.lrec-conf.org/proceedings/lrec2012/pdf/274_Paper.pdf
201215message PartOfSpeech {
202216 // The part of speech tags enum.
203217 enum Tag {
@@ -525,7 +539,9 @@ message PartOfSpeech {
525539 Voice voice = 12 ;
526540}
527541
528- // Represents dependency parse tree information for a token.
542+ // Represents dependency parse tree information for a token. (For more
543+ // information on dependency labels, see
544+ // http://www.aclweb.org/anthology/P13-2017
529545message DependencyEdge {
530546 // The parse label enum for the token.
531547 enum Label {
@@ -759,6 +775,24 @@ message DependencyEdge {
759775
760776 // Dislocated relation (for fronted/topicalized elements)
761777 DISLOCATED = 76 ;
778+
779+ // Aspect marker
780+ ASP = 77 ;
781+
782+ // Genitive modifier
783+ GMOD = 78 ;
784+
785+ // Genitive object
786+ GOBJ = 79 ;
787+
788+ // Infinitival modifier
789+ INFMOD = 80 ;
790+
791+ // Measure
792+ MES = 81 ;
793+
794+ // Nominal complement of a noun
795+ NCOMP = 82 ;
762796 }
763797
764798 // Represents the head of this token in the dependency tree.
@@ -792,6 +826,12 @@ message EntityMention {
792826
793827 // The type of the entity mention.
794828 Type type = 2 ;
829+
830+ // For calls to [AnalyzeEntitySentiment][] or if
831+ // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] is set to
832+ // true, this field will contain the sentiment expressed for this mention of
833+ // the entity in the provided document.
834+ Sentiment sentiment = 3 ;
795835}
796836
797837// Represents an output piece of text.
@@ -800,17 +840,26 @@ message TextSpan {
800840 string content = 1 ;
801841
802842 // The API calculates the beginning offset of the content in the original
803- // document according to the [EncodingType][google.cloud.language.v1beta1 .EncodingType] specified in the API request.
843+ // document according to the [EncodingType][google.cloud.language.v1 .EncodingType] specified in the API request.
804844 int32 begin_offset = 2 ;
805845}
806846
847+ // Represents a category returned from the text classifier.
848+ message ClassificationCategory {
849+ // The name of the category representing the document.
850+ string name = 1 ;
851+
852+ // The classifier's confidence of the category. Number represents how certain
853+ // the classifier is that this category represents the given text.
854+ float confidence = 2 ;
855+ }
856+
807857// The sentiment analysis request message.
808858message AnalyzeSentimentRequest {
809859 // Input document.
810860 Document document = 1 ;
811861
812- // The encoding type used by the API to calculate sentence offsets for the
813- // sentence sentiment.
862+ // The encoding type used by the API to calculate sentence offsets.
814863 EncodingType encoding_type = 2 ;
815864}
816865
@@ -821,13 +870,33 @@ message AnalyzeSentimentResponse {
821870
822871 // The language of the text, which will be the same as the language specified
823872 // in the request or, if not specified, the automatically-detected language.
824- // See [Document.language][google.cloud.language.v1beta1 .Document.language] field for more details.
873+ // See [Document.language][google.cloud.language.v1 .Document.language] field for more details.
825874 string language = 2 ;
826875
827876 // The sentiment for all the sentences in the document.
828877 repeated Sentence sentences = 3 ;
829878}
830879
880+ // The entity-level sentiment analysis request message.
881+ message AnalyzeEntitySentimentRequest {
882+ // Input document.
883+ Document document = 1 ;
884+
885+ // The encoding type used by the API to calculate offsets.
886+ EncodingType encoding_type = 2 ;
887+ }
888+
889+ // The entity-level sentiment analysis response message.
890+ message AnalyzeEntitySentimentResponse {
891+ // The recognized entities in the input document with associated sentiments.
892+ repeated Entity entities = 1 ;
893+
894+ // The language of the text, which will be the same as the language specified
895+ // in the request or, if not specified, the automatically-detected language.
896+ // See [Document.language][google.cloud.language.v1.Document.language] field for more details.
897+ string language = 2 ;
898+ }
899+
831900// The entity analysis request message.
832901message AnalyzeEntitiesRequest {
833902 // Input document.
@@ -844,7 +913,7 @@ message AnalyzeEntitiesResponse {
844913
845914 // The language of the text, which will be the same as the language specified
846915 // in the request or, if not specified, the automatically-detected language.
847- // See [Document.language][google.cloud.language.v1beta1 .Document.language] field for more details.
916+ // See [Document.language][google.cloud.language.v1 .Document.language] field for more details.
848917 string language = 2 ;
849918}
850919
@@ -867,10 +936,22 @@ message AnalyzeSyntaxResponse {
867936
868937 // The language of the text, which will be the same as the language specified
869938 // in the request or, if not specified, the automatically-detected language.
870- // See [Document.language][google.cloud.language.v1beta1 .Document.language] field for more details.
939+ // See [Document.language][google.cloud.language.v1 .Document.language] field for more details.
871940 string language = 3 ;
872941}
873942
943+ // The document classification request message.
944+ message ClassifyTextRequest {
945+ // Input document.
946+ Document document = 1 ;
947+ }
948+
949+ // The document classification response message.
950+ message ClassifyTextResponse {
951+ // Categories representing the input document.
952+ repeated ClassificationCategory categories = 1 ;
953+ }
954+
874955// The request message for the text annotation API, which can perform multiple
875956// analysis types (sentiment, entities, and syntax) in one call.
876957message AnnotateTextRequest {
@@ -885,6 +966,12 @@ message AnnotateTextRequest {
885966
886967 // Extract document-level sentiment.
887968 bool extract_document_sentiment = 3 ;
969+
970+ // Extract entities and their associated sentiment.
971+ bool extract_entity_sentiment = 4 ;
972+
973+ // Classify the full document into categories.
974+ bool classify_text = 6 ;
888975 }
889976
890977 // Input document.
@@ -900,27 +987,30 @@ message AnnotateTextRequest {
900987// The text annotations response message.
901988message AnnotateTextResponse {
902989 // Sentences in the input document. Populated if the user enables
903- // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta1 .AnnotateTextRequest.Features.extract_syntax].
990+ // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1 .AnnotateTextRequest.Features.extract_syntax].
904991 repeated Sentence sentences = 1 ;
905992
906993 // Tokens, along with their syntactic information, in the input document.
907994 // Populated if the user enables
908- // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta1 .AnnotateTextRequest.Features.extract_syntax].
995+ // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1 .AnnotateTextRequest.Features.extract_syntax].
909996 repeated Token tokens = 2 ;
910997
911998 // Entities, along with their semantic information, in the input document.
912999 // Populated if the user enables
913- // [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1beta1 .AnnotateTextRequest.Features.extract_entities].
1000+ // [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1 .AnnotateTextRequest.Features.extract_entities].
9141001 repeated Entity entities = 3 ;
9151002
9161003 // The overall sentiment for the document. Populated if the user enables
917- // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta1 .AnnotateTextRequest.Features.extract_document_sentiment].
1004+ // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1 .AnnotateTextRequest.Features.extract_document_sentiment].
9181005 Sentiment document_sentiment = 4 ;
9191006
9201007 // The language of the text, which will be the same as the language specified
9211008 // in the request or, if not specified, the automatically-detected language.
922- // See [Document.language][google.cloud.language.v1beta1 .Document.language] field for more details.
1009+ // See [Document.language][google.cloud.language.v1 .Document.language] field for more details.
9231010 string language = 5 ;
1011+
1012+ // Categories identified in the input document.
1013+ repeated ClassificationCategory categories = 6 ;
9241014}
9251015
9261016// Represents the text encoding that the caller uses to process the output.
0 commit comments