language_service.proto 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122
  1. // Copyright 2019 Google LLC.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. //
  15. syntax = "proto3";
  16. package google.cloud.language.v1;
  17. import "google/api/annotations.proto";
  18. import "google/api/client.proto";
  19. import "google/api/field_behavior.proto";
  20. option go_package = "google.golang.org/genproto/googleapis/cloud/language/v1;language";
  21. option java_multiple_files = true;
  22. option java_outer_classname = "LanguageServiceProto";
  23. option java_package = "com.google.cloud.language.v1";
  24. // Provides text analysis operations such as sentiment analysis and entity
  25. // recognition.
  26. service LanguageService {
  27. option (google.api.default_host) = "language.googleapis.com";
  28. option (google.api.oauth_scopes) =
  29. "https://www.googleapis.com/auth/cloud-language,"
  30. "https://www.googleapis.com/auth/cloud-platform";
  31. // Analyzes the sentiment of the provided text.
  32. rpc AnalyzeSentiment(AnalyzeSentimentRequest) returns (AnalyzeSentimentResponse) {
  33. option (google.api.http) = {
  34. post: "/v1/documents:analyzeSentiment"
  35. body: "*"
  36. };
  37. option (google.api.method_signature) = "document,encoding_type";
  38. option (google.api.method_signature) = "document";
  39. }
  40. // Finds named entities (currently proper names and common nouns) in the text
  41. // along with entity types, salience, mentions for each entity, and
  42. // other properties.
  43. rpc AnalyzeEntities(AnalyzeEntitiesRequest) returns (AnalyzeEntitiesResponse) {
  44. option (google.api.http) = {
  45. post: "/v1/documents:analyzeEntities"
  46. body: "*"
  47. };
  48. option (google.api.method_signature) = "document,encoding_type";
  49. option (google.api.method_signature) = "document";
  50. }
  51. // Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes
  52. // sentiment associated with each entity and its mentions.
  53. rpc AnalyzeEntitySentiment(AnalyzeEntitySentimentRequest) returns (AnalyzeEntitySentimentResponse) {
  54. option (google.api.http) = {
  55. post: "/v1/documents:analyzeEntitySentiment"
  56. body: "*"
  57. };
  58. option (google.api.method_signature) = "document,encoding_type";
  59. option (google.api.method_signature) = "document";
  60. }
  61. // Analyzes the syntax of the text and provides sentence boundaries and
  62. // tokenization along with part of speech tags, dependency trees, and other
  63. // properties.
  64. rpc AnalyzeSyntax(AnalyzeSyntaxRequest) returns (AnalyzeSyntaxResponse) {
  65. option (google.api.http) = {
  66. post: "/v1/documents:analyzeSyntax"
  67. body: "*"
  68. };
  69. option (google.api.method_signature) = "document,encoding_type";
  70. option (google.api.method_signature) = "document";
  71. }
  72. // Classifies a document into categories.
  73. rpc ClassifyText(ClassifyTextRequest) returns (ClassifyTextResponse) {
  74. option (google.api.http) = {
  75. post: "/v1/documents:classifyText"
  76. body: "*"
  77. };
  78. option (google.api.method_signature) = "document";
  79. }
  80. // A convenience method that provides all the features that analyzeSentiment,
  81. // analyzeEntities, and analyzeSyntax provide in one call.
  82. rpc AnnotateText(AnnotateTextRequest) returns (AnnotateTextResponse) {
  83. option (google.api.http) = {
  84. post: "/v1/documents:annotateText"
  85. body: "*"
  86. };
  87. option (google.api.method_signature) = "document,features,encoding_type";
  88. option (google.api.method_signature) = "document,features";
  89. }
  90. }
  91. //
  92. // Represents the input to API methods.
  93. message Document {
  94. // The document types enum.
  95. enum Type {
  96. // The content type is not specified.
  97. TYPE_UNSPECIFIED = 0;
  98. // Plain text
  99. PLAIN_TEXT = 1;
  100. // HTML
  101. HTML = 2;
  102. }
  103. // Required. If the type is not set or is `TYPE_UNSPECIFIED`,
  104. // returns an `INVALID_ARGUMENT` error.
  105. Type type = 1;
  106. // The source of the document: a string containing the content or a
  107. // Google Cloud Storage URI.
  108. oneof source {
  109. // The content of the input in string format.
  110. // Cloud audit logging exempt since it is based on user data.
  111. string content = 2;
  112. // The Google Cloud Storage URI where the file content is located.
  113. // This URI must be of the form: gs://bucket_name/object_name. For more
  114. // details, see https://cloud.google.com/storage/docs/reference-uris.
  115. // NOTE: Cloud Storage object versioning is not supported.
  116. string gcs_content_uri = 3;
  117. }
  118. // The language of the document (if not specified, the language is
  119. // automatically detected). Both ISO and BCP-47 language codes are
  120. // accepted.<br>
  121. // [Language
  122. // Support](https://cloud.google.com/natural-language/docs/languages) lists
  123. // currently supported languages for each API method. If the language (either
  124. // specified by the caller or automatically detected) is not supported by the
  125. // called API method, an `INVALID_ARGUMENT` error is returned.
  126. string language = 4;
  127. }
  128. // Represents a sentence in the input document.
  129. message Sentence {
  130. // The sentence text.
  131. TextSpan text = 1;
  132. // For calls to [AnalyzeSentiment][] or if
  133. // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment] is set to
  134. // true, this field will contain the sentiment for the sentence.
  135. Sentiment sentiment = 2;
  136. }
  137. // Represents a phrase in the text that is a known entity, such as
  138. // a person, an organization, or location. The API associates information, such
  139. // as salience and mentions, with entities.
  140. message Entity {
  141. // The type of the entity. For most entity types, the associated metadata is a
  142. // Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table
  143. // below lists the associated fields for entities that have different
  144. // metadata.
  145. enum Type {
  146. // Unknown
  147. UNKNOWN = 0;
  148. // Person
  149. PERSON = 1;
  150. // Location
  151. LOCATION = 2;
  152. // Organization
  153. ORGANIZATION = 3;
  154. // Event
  155. EVENT = 4;
  156. // Artwork
  157. WORK_OF_ART = 5;
  158. // Consumer product
  159. CONSUMER_GOOD = 6;
  160. // Other types of entities
  161. OTHER = 7;
  162. // Phone number<br><br>
  163. // The metadata lists the phone number, formatted according to local
  164. // convention, plus whichever additional elements appear in the text:<ul>
  165. // <li><code>number</code> &ndash; the actual number, broken down into
  166. // sections as per local convention</li> <li><code>national_prefix</code>
  167. // &ndash; country code, if detected</li> <li><code>area_code</code> &ndash;
  168. // region or area code, if detected</li> <li><code>extension</code> &ndash;
  169. // phone extension (to be dialed after connection), if detected</li></ul>
  170. PHONE_NUMBER = 9;
  171. // Address<br><br>
  172. // The metadata identifies the street number and locality plus whichever
  173. // additional elements appear in the text:<ul>
  174. // <li><code>street_number</code> &ndash; street number</li>
  175. // <li><code>locality</code> &ndash; city or town</li>
  176. // <li><code>street_name</code> &ndash; street/route name, if detected</li>
  177. // <li><code>postal_code</code> &ndash; postal code, if detected</li>
  178. // <li><code>country</code> &ndash; country, if detected</li>
  179. // <li><code>broad_region</code> &ndash; administrative area, such as the
  180. // state, if detected</li> <li><code>narrow_region</code> &ndash; smaller
  181. // administrative area, such as county, if detected</li>
  182. // <li><code>sublocality</code> &ndash; used in Asian addresses to demark a
  183. // district within a city, if detected</li></ul>
  184. ADDRESS = 10;
  185. // Date<br><br>
  186. // The metadata identifies the components of the date:<ul>
  187. // <li><code>year</code> &ndash; four digit year, if detected</li>
  188. // <li><code>month</code> &ndash; two digit month number, if detected</li>
  189. // <li><code>day</code> &ndash; two digit day number, if detected</li></ul>
  190. DATE = 11;
  191. // Number<br><br>
  192. // The metadata is the number itself.
  193. NUMBER = 12;
  194. // Price<br><br>
  195. // The metadata identifies the <code>value</code> and <code>currency</code>.
  196. PRICE = 13;
  197. }
  198. // The representative name for the entity.
  199. string name = 1;
  200. // The entity type.
  201. Type type = 2;
  202. // Metadata associated with the entity.
  203. //
  204. // For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`)
  205. // and Knowledge Graph MID (`mid`), if they are available. For the metadata
  206. // associated with other entity types, see the Type table below.
  207. map<string, string> metadata = 3;
  208. // The salience score associated with the entity in the [0, 1.0] range.
  209. //
  210. // The salience score for an entity provides information about the
  211. // importance or centrality of that entity to the entire document text.
  212. // Scores closer to 0 are less salient, while scores closer to 1.0 are highly
  213. // salient.
  214. float salience = 4;
  215. // The mentions of this entity in the input document. The API currently
  216. // supports proper noun mentions.
  217. repeated EntityMention mentions = 5;
  218. // For calls to [AnalyzeEntitySentiment][] or if
  219. // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] is set to
  220. // true, this field will contain the aggregate sentiment expressed for this
  221. // entity in the provided document.
  222. Sentiment sentiment = 6;
  223. }
  224. // Represents the text encoding that the caller uses to process the output.
  225. // Providing an `EncodingType` is recommended because the API provides the
  226. // beginning offsets for various outputs, such as tokens and mentions, and
  227. // languages that natively use different text encodings may access offsets
  228. // differently.
  229. enum EncodingType {
  230. // If `EncodingType` is not specified, encoding-dependent information (such as
  231. // `begin_offset`) will be set at `-1`.
  232. NONE = 0;
  233. // Encoding-dependent information (such as `begin_offset`) is calculated based
  234. // on the UTF-8 encoding of the input. C++ and Go are examples of languages
  235. // that use this encoding natively.
  236. UTF8 = 1;
  237. // Encoding-dependent information (such as `begin_offset`) is calculated based
  238. // on the UTF-16 encoding of the input. Java and JavaScript are examples of
  239. // languages that use this encoding natively.
  240. UTF16 = 2;
  241. // Encoding-dependent information (such as `begin_offset`) is calculated based
  242. // on the UTF-32 encoding of the input. Python is an example of a language
  243. // that uses this encoding natively.
  244. UTF32 = 3;
  245. }
  246. // Represents the smallest syntactic building block of the text.
  247. message Token {
  248. // The token text.
  249. TextSpan text = 1;
  250. // Parts of speech tag for this token.
  251. PartOfSpeech part_of_speech = 2;
  252. // Dependency tree parse for this token.
  253. DependencyEdge dependency_edge = 3;
  254. // [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
  255. string lemma = 4;
  256. }
  257. // Represents the feeling associated with the entire text or entities in
  258. // the text.
  259. message Sentiment {
  260. // A non-negative number in the [0, +inf) range, which represents
  261. // the absolute magnitude of sentiment regardless of score (positive or
  262. // negative).
  263. float magnitude = 2;
  264. // Sentiment score between -1.0 (negative sentiment) and 1.0
  265. // (positive sentiment).
  266. float score = 3;
  267. }
  268. // Represents part of speech information for a token. Parts of speech
  269. // are as defined in
  270. // http://www.lrec-conf.org/proceedings/lrec2012/pdf/274_Paper.pdf
  271. message PartOfSpeech {
  272. // The part of speech tags enum.
  273. enum Tag {
  274. // Unknown
  275. UNKNOWN = 0;
  276. // Adjective
  277. ADJ = 1;
  278. // Adposition (preposition and postposition)
  279. ADP = 2;
  280. // Adverb
  281. ADV = 3;
  282. // Conjunction
  283. CONJ = 4;
  284. // Determiner
  285. DET = 5;
  286. // Noun (common and proper)
  287. NOUN = 6;
  288. // Cardinal number
  289. NUM = 7;
  290. // Pronoun
  291. PRON = 8;
  292. // Particle or other function word
  293. PRT = 9;
  294. // Punctuation
  295. PUNCT = 10;
  296. // Verb (all tenses and modes)
  297. VERB = 11;
  298. // Other: foreign words, typos, abbreviations
  299. X = 12;
  300. // Affix
  301. AFFIX = 13;
  302. }
  303. // The characteristic of a verb that expresses time flow during an event.
  304. enum Aspect {
  305. // Aspect is not applicable in the analyzed language or is not predicted.
  306. ASPECT_UNKNOWN = 0;
  307. // Perfective
  308. PERFECTIVE = 1;
  309. // Imperfective
  310. IMPERFECTIVE = 2;
  311. // Progressive
  312. PROGRESSIVE = 3;
  313. }
  314. // The grammatical function performed by a noun or pronoun in a phrase,
  315. // clause, or sentence. In some languages, other parts of speech, such as
  316. // adjective and determiner, take case inflection in agreement with the noun.
  317. enum Case {
  318. // Case is not applicable in the analyzed language or is not predicted.
  319. CASE_UNKNOWN = 0;
  320. // Accusative
  321. ACCUSATIVE = 1;
  322. // Adverbial
  323. ADVERBIAL = 2;
  324. // Complementive
  325. COMPLEMENTIVE = 3;
  326. // Dative
  327. DATIVE = 4;
  328. // Genitive
  329. GENITIVE = 5;
  330. // Instrumental
  331. INSTRUMENTAL = 6;
  332. // Locative
  333. LOCATIVE = 7;
  334. // Nominative
  335. NOMINATIVE = 8;
  336. // Oblique
  337. OBLIQUE = 9;
  338. // Partitive
  339. PARTITIVE = 10;
  340. // Prepositional
  341. PREPOSITIONAL = 11;
  342. // Reflexive
  343. REFLEXIVE_CASE = 12;
  344. // Relative
  345. RELATIVE_CASE = 13;
  346. // Vocative
  347. VOCATIVE = 14;
  348. }
  349. // Depending on the language, Form can be categorizing different forms of
  350. // verbs, adjectives, adverbs, etc. For example, categorizing inflected
  351. // endings of verbs and adjectives or distinguishing between short and long
  352. // forms of adjectives and participles
  353. enum Form {
  354. // Form is not applicable in the analyzed language or is not predicted.
  355. FORM_UNKNOWN = 0;
  356. // Adnomial
  357. ADNOMIAL = 1;
  358. // Auxiliary
  359. AUXILIARY = 2;
  360. // Complementizer
  361. COMPLEMENTIZER = 3;
  362. // Final ending
  363. FINAL_ENDING = 4;
  364. // Gerund
  365. GERUND = 5;
  366. // Realis
  367. REALIS = 6;
  368. // Irrealis
  369. IRREALIS = 7;
  370. // Short form
  371. SHORT = 8;
  372. // Long form
  373. LONG = 9;
  374. // Order form
  375. ORDER = 10;
  376. // Specific form
  377. SPECIFIC = 11;
  378. }
  379. // Gender classes of nouns reflected in the behaviour of associated words.
  380. enum Gender {
  381. // Gender is not applicable in the analyzed language or is not predicted.
  382. GENDER_UNKNOWN = 0;
  383. // Feminine
  384. FEMININE = 1;
  385. // Masculine
  386. MASCULINE = 2;
  387. // Neuter
  388. NEUTER = 3;
  389. }
  390. // The grammatical feature of verbs, used for showing modality and attitude.
  391. enum Mood {
  392. // Mood is not applicable in the analyzed language or is not predicted.
  393. MOOD_UNKNOWN = 0;
  394. // Conditional
  395. CONDITIONAL_MOOD = 1;
  396. // Imperative
  397. IMPERATIVE = 2;
  398. // Indicative
  399. INDICATIVE = 3;
  400. // Interrogative
  401. INTERROGATIVE = 4;
  402. // Jussive
  403. JUSSIVE = 5;
  404. // Subjunctive
  405. SUBJUNCTIVE = 6;
  406. }
  407. // Count distinctions.
  408. enum Number {
  409. // Number is not applicable in the analyzed language or is not predicted.
  410. NUMBER_UNKNOWN = 0;
  411. // Singular
  412. SINGULAR = 1;
  413. // Plural
  414. PLURAL = 2;
  415. // Dual
  416. DUAL = 3;
  417. }
  418. // The distinction between the speaker, second person, third person, etc.
  419. enum Person {
  420. // Person is not applicable in the analyzed language or is not predicted.
  421. PERSON_UNKNOWN = 0;
  422. // First
  423. FIRST = 1;
  424. // Second
  425. SECOND = 2;
  426. // Third
  427. THIRD = 3;
  428. // Reflexive
  429. REFLEXIVE_PERSON = 4;
  430. }
  431. // This category shows if the token is part of a proper name.
  432. enum Proper {
  433. // Proper is not applicable in the analyzed language or is not predicted.
  434. PROPER_UNKNOWN = 0;
  435. // Proper
  436. PROPER = 1;
  437. // Not proper
  438. NOT_PROPER = 2;
  439. }
  440. // Reciprocal features of a pronoun.
  441. enum Reciprocity {
  442. // Reciprocity is not applicable in the analyzed language or is not
  443. // predicted.
  444. RECIPROCITY_UNKNOWN = 0;
  445. // Reciprocal
  446. RECIPROCAL = 1;
  447. // Non-reciprocal
  448. NON_RECIPROCAL = 2;
  449. }
  450. // Time reference.
  451. enum Tense {
  452. // Tense is not applicable in the analyzed language or is not predicted.
  453. TENSE_UNKNOWN = 0;
  454. // Conditional
  455. CONDITIONAL_TENSE = 1;
  456. // Future
  457. FUTURE = 2;
  458. // Past
  459. PAST = 3;
  460. // Present
  461. PRESENT = 4;
  462. // Imperfect
  463. IMPERFECT = 5;
  464. // Pluperfect
  465. PLUPERFECT = 6;
  466. }
  467. // The relationship between the action that a verb expresses and the
  468. // participants identified by its arguments.
  469. enum Voice {
  470. // Voice is not applicable in the analyzed language or is not predicted.
  471. VOICE_UNKNOWN = 0;
  472. // Active
  473. ACTIVE = 1;
  474. // Causative
  475. CAUSATIVE = 2;
  476. // Passive
  477. PASSIVE = 3;
  478. }
  479. // The part of speech tag.
  480. Tag tag = 1;
  481. // The grammatical aspect.
  482. Aspect aspect = 2;
  483. // The grammatical case.
  484. Case case = 3;
  485. // The grammatical form.
  486. Form form = 4;
  487. // The grammatical gender.
  488. Gender gender = 5;
  489. // The grammatical mood.
  490. Mood mood = 6;
  491. // The grammatical number.
  492. Number number = 7;
  493. // The grammatical person.
  494. Person person = 8;
  495. // The grammatical properness.
  496. Proper proper = 9;
  497. // The grammatical reciprocity.
  498. Reciprocity reciprocity = 10;
  499. // The grammatical tense.
  500. Tense tense = 11;
  501. // The grammatical voice.
  502. Voice voice = 12;
  503. }
  504. // Represents dependency parse tree information for a token. (For more
  505. // information on dependency labels, see
  506. // http://www.aclweb.org/anthology/P13-2017
  507. message DependencyEdge {
  508. // The parse label enum for the token.
  509. enum Label {
  510. // Unknown
  511. UNKNOWN = 0;
  512. // Abbreviation modifier
  513. ABBREV = 1;
  514. // Adjectival complement
  515. ACOMP = 2;
  516. // Adverbial clause modifier
  517. ADVCL = 3;
  518. // Adverbial modifier
  519. ADVMOD = 4;
  520. // Adjectival modifier of an NP
  521. AMOD = 5;
  522. // Appositional modifier of an NP
  523. APPOS = 6;
  524. // Attribute dependent of a copular verb
  525. ATTR = 7;
  526. // Auxiliary (non-main) verb
  527. AUX = 8;
  528. // Passive auxiliary
  529. AUXPASS = 9;
  530. // Coordinating conjunction
  531. CC = 10;
  532. // Clausal complement of a verb or adjective
  533. CCOMP = 11;
  534. // Conjunct
  535. CONJ = 12;
  536. // Clausal subject
  537. CSUBJ = 13;
  538. // Clausal passive subject
  539. CSUBJPASS = 14;
  540. // Dependency (unable to determine)
  541. DEP = 15;
  542. // Determiner
  543. DET = 16;
  544. // Discourse
  545. DISCOURSE = 17;
  546. // Direct object
  547. DOBJ = 18;
  548. // Expletive
  549. EXPL = 19;
  550. // Goes with (part of a word in a text not well edited)
  551. GOESWITH = 20;
  552. // Indirect object
  553. IOBJ = 21;
  554. // Marker (word introducing a subordinate clause)
  555. MARK = 22;
  556. // Multi-word expression
  557. MWE = 23;
  558. // Multi-word verbal expression
  559. MWV = 24;
  560. // Negation modifier
  561. NEG = 25;
  562. // Noun compound modifier
  563. NN = 26;
  564. // Noun phrase used as an adverbial modifier
  565. NPADVMOD = 27;
  566. // Nominal subject
  567. NSUBJ = 28;
  568. // Passive nominal subject
  569. NSUBJPASS = 29;
  570. // Numeric modifier of a noun
  571. NUM = 30;
  572. // Element of compound number
  573. NUMBER = 31;
  574. // Punctuation mark
  575. P = 32;
  576. // Parataxis relation
  577. PARATAXIS = 33;
  578. // Participial modifier
  579. PARTMOD = 34;
  580. // The complement of a preposition is a clause
  581. PCOMP = 35;
  582. // Object of a preposition
  583. POBJ = 36;
  584. // Possession modifier
  585. POSS = 37;
  586. // Postverbal negative particle
  587. POSTNEG = 38;
  588. // Predicate complement
  589. PRECOMP = 39;
  590. // Preconjunt
  591. PRECONJ = 40;
  592. // Predeterminer
  593. PREDET = 41;
  594. // Prefix
  595. PREF = 42;
  596. // Prepositional modifier
  597. PREP = 43;
  598. // The relationship between a verb and verbal morpheme
  599. PRONL = 44;
  600. // Particle
  601. PRT = 45;
  602. // Associative or possessive marker
  603. PS = 46;
  604. // Quantifier phrase modifier
  605. QUANTMOD = 47;
  606. // Relative clause modifier
  607. RCMOD = 48;
  608. // Complementizer in relative clause
  609. RCMODREL = 49;
  610. // Ellipsis without a preceding predicate
  611. RDROP = 50;
  612. // Referent
  613. REF = 51;
  614. // Remnant
  615. REMNANT = 52;
  616. // Reparandum
  617. REPARANDUM = 53;
  618. // Root
  619. ROOT = 54;
  620. // Suffix specifying a unit of number
  621. SNUM = 55;
  622. // Suffix
  623. SUFF = 56;
  624. // Temporal modifier
  625. TMOD = 57;
  626. // Topic marker
  627. TOPIC = 58;
  628. // Clause headed by an infinite form of the verb that modifies a noun
  629. VMOD = 59;
  630. // Vocative
  631. VOCATIVE = 60;
  632. // Open clausal complement
  633. XCOMP = 61;
  634. // Name suffix
  635. SUFFIX = 62;
  636. // Name title
  637. TITLE = 63;
  638. // Adverbial phrase modifier
  639. ADVPHMOD = 64;
  640. // Causative auxiliary
  641. AUXCAUS = 65;
  642. // Helper auxiliary
  643. AUXVV = 66;
  644. // Rentaishi (Prenominal modifier)
  645. DTMOD = 67;
  646. // Foreign words
  647. FOREIGN = 68;
  648. // Keyword
  649. KW = 69;
  650. // List for chains of comparable items
  651. LIST = 70;
  652. // Nominalized clause
  653. NOMC = 71;
  654. // Nominalized clausal subject
  655. NOMCSUBJ = 72;
  656. // Nominalized clausal passive
  657. NOMCSUBJPASS = 73;
  658. // Compound of numeric modifier
  659. NUMC = 74;
  660. // Copula
  661. COP = 75;
  662. // Dislocated relation (for fronted/topicalized elements)
  663. DISLOCATED = 76;
  664. // Aspect marker
  665. ASP = 77;
  666. // Genitive modifier
  667. GMOD = 78;
  668. // Genitive object
  669. GOBJ = 79;
  670. // Infinitival modifier
  671. INFMOD = 80;
  672. // Measure
  673. MES = 81;
  674. // Nominal complement of a noun
  675. NCOMP = 82;
  676. }
  677. // Represents the head of this token in the dependency tree.
  678. // This is the index of the token which has an arc going to this token.
  679. // The index is the position of the token in the array of tokens returned
  680. // by the API method. If this token is a root token, then the
  681. // `head_token_index` is its own index.
  682. int32 head_token_index = 1;
  683. // The parse label for the token.
  684. Label label = 2;
  685. }
  686. // Represents a mention for an entity in the text. Currently, proper noun
  687. // mentions are supported.
  688. message EntityMention {
  689. // The supported types of mentions.
  690. enum Type {
  691. // Unknown
  692. TYPE_UNKNOWN = 0;
  693. // Proper name
  694. PROPER = 1;
  695. // Common noun (or noun compound)
  696. COMMON = 2;
  697. }
  698. // The mention text.
  699. TextSpan text = 1;
  700. // The type of the entity mention.
  701. Type type = 2;
  702. // For calls to [AnalyzeEntitySentiment][] or if
  703. // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] is set to
  704. // true, this field will contain the sentiment expressed for this mention of
  705. // the entity in the provided document.
  706. Sentiment sentiment = 3;
  707. }
  708. // Represents an output piece of text.
  709. message TextSpan {
  710. // The content of the output text.
  711. string content = 1;
  712. // The API calculates the beginning offset of the content in the original
  713. // document according to the [EncodingType][google.cloud.language.v1.EncodingType] specified in the API request.
  714. int32 begin_offset = 2;
  715. }
  716. // Represents a category returned from the text classifier.
  717. message ClassificationCategory {
  718. // The name of the category representing the document, from the [predefined
  719. // taxonomy](https://cloud.google.com/natural-language/docs/categories).
  720. string name = 1;
  721. // The classifier's confidence of the category. Number represents how certain
  722. // the classifier is that this category represents the given text.
  723. float confidence = 2;
  724. }
  725. // The sentiment analysis request message.
  726. message AnalyzeSentimentRequest {
  727. // Input document.
  728. Document document = 1 [(google.api.field_behavior) = REQUIRED];
  729. // The encoding type used by the API to calculate sentence offsets.
  730. EncodingType encoding_type = 2;
  731. }
  732. // The sentiment analysis response message.
  733. message AnalyzeSentimentResponse {
  734. // The overall sentiment of the input document.
  735. Sentiment document_sentiment = 1;
  736. // The language of the text, which will be the same as the language specified
  737. // in the request or, if not specified, the automatically-detected language.
  738. // See [Document.language][google.cloud.language.v1.Document.language] field for more details.
  739. string language = 2;
  740. // The sentiment for all the sentences in the document.
  741. repeated Sentence sentences = 3;
  742. }
  743. // The entity-level sentiment analysis request message.
  744. message AnalyzeEntitySentimentRequest {
  745. // Input document.
  746. Document document = 1 [(google.api.field_behavior) = REQUIRED];
  747. // The encoding type used by the API to calculate offsets.
  748. EncodingType encoding_type = 2;
  749. }
  750. // The entity-level sentiment analysis response message.
  751. message AnalyzeEntitySentimentResponse {
  752. // The recognized entities in the input document with associated sentiments.
  753. repeated Entity entities = 1;
  754. // The language of the text, which will be the same as the language specified
  755. // in the request or, if not specified, the automatically-detected language.
  756. // See [Document.language][google.cloud.language.v1.Document.language] field for more details.
  757. string language = 2;
  758. }
  759. // The entity analysis request message.
  760. message AnalyzeEntitiesRequest {
  761. // Input document.
  762. Document document = 1 [(google.api.field_behavior) = REQUIRED];
  763. // The encoding type used by the API to calculate offsets.
  764. EncodingType encoding_type = 2;
  765. }
  766. // The entity analysis response message.
  767. message AnalyzeEntitiesResponse {
  768. // The recognized entities in the input document.
  769. repeated Entity entities = 1;
  770. // The language of the text, which will be the same as the language specified
  771. // in the request or, if not specified, the automatically-detected language.
  772. // See [Document.language][google.cloud.language.v1.Document.language] field for more details.
  773. string language = 2;
  774. }
  775. // The syntax analysis request message.
  776. message AnalyzeSyntaxRequest {
  777. // Input document.
  778. Document document = 1 [(google.api.field_behavior) = REQUIRED];
  779. // The encoding type used by the API to calculate offsets.
  780. EncodingType encoding_type = 2;
  781. }
  782. // The syntax analysis response message.
  783. message AnalyzeSyntaxResponse {
  784. // Sentences in the input document.
  785. repeated Sentence sentences = 1;
  786. // Tokens, along with their syntactic information, in the input document.
  787. repeated Token tokens = 2;
  788. // The language of the text, which will be the same as the language specified
  789. // in the request or, if not specified, the automatically-detected language.
  790. // See [Document.language][google.cloud.language.v1.Document.language] field for more details.
  791. string language = 3;
  792. }
  793. // The document classification request message.
  794. message ClassifyTextRequest {
  795. // Input document.
  796. Document document = 1 [(google.api.field_behavior) = REQUIRED];
  797. }
  798. // The document classification response message.
  799. message ClassifyTextResponse {
  800. // Categories representing the input document.
  801. repeated ClassificationCategory categories = 1;
  802. }
  803. // The request message for the text annotation API, which can perform multiple
  804. // analysis types (sentiment, entities, and syntax) in one call.
  805. message AnnotateTextRequest {
  806. // All available features for sentiment, syntax, and semantic analysis.
  807. // Setting each one to true will enable that specific analysis for the input.
  808. message Features {
  809. // Extract syntax information.
  810. bool extract_syntax = 1;
  811. // Extract entities.
  812. bool extract_entities = 2;
  813. // Extract document-level sentiment.
  814. bool extract_document_sentiment = 3;
  815. // Extract entities and their associated sentiment.
  816. bool extract_entity_sentiment = 4;
  817. // Classify the full document into categories.
  818. bool classify_text = 6;
  819. }
  820. // Input document.
  821. Document document = 1 [(google.api.field_behavior) = REQUIRED];
  822. // The enabled features.
  823. Features features = 2 [(google.api.field_behavior) = REQUIRED];
  824. // The encoding type used by the API to calculate offsets.
  825. EncodingType encoding_type = 3;
  826. }
  827. // The text annotations response message.
  828. message AnnotateTextResponse {
  829. // Sentences in the input document. Populated if the user enables
  830. // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
  831. repeated Sentence sentences = 1;
  832. // Tokens, along with their syntactic information, in the input document.
  833. // Populated if the user enables
  834. // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
  835. repeated Token tokens = 2;
  836. // Entities, along with their semantic information, in the input document.
  837. // Populated if the user enables
  838. // [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
  839. repeated Entity entities = 3;
  840. // The overall sentiment for the document. Populated if the user enables
  841. // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
  842. Sentiment document_sentiment = 4;
  843. // The language of the text, which will be the same as the language specified
  844. // in the request or, if not specified, the automatically-detected language.
  845. // See [Document.language][google.cloud.language.v1.Document.language] field for more details.
  846. string language = 5;
  847. // Categories identified in the input document.
  848. repeated ClassificationCategory categories = 6;
  849. }