language_service.proto 30 KB

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