language_service.proto 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134
  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.v1beta2;
  17. import "google/api/annotations.proto";
  18. import "google/api/client.proto";
  19. import "google/api/field_behavior.proto";
  20. import "google/protobuf/timestamp.proto";
  21. option go_package = "google.golang.org/genproto/googleapis/cloud/language/v1beta2;language";
  22. option java_multiple_files = true;
  23. option java_outer_classname = "LanguageServiceProto";
  24. option java_package = "com.google.cloud.language.v1beta2";
  25. // Provides text analysis operations such as sentiment analysis and entity
  26. // recognition.
  27. service LanguageService {
  28. option (google.api.default_host) = "language.googleapis.com";
  29. option (google.api.oauth_scopes) =
  30. "https://www.googleapis.com/auth/cloud-language,"
  31. "https://www.googleapis.com/auth/cloud-platform";
  32. // Analyzes the sentiment of the provided text.
  33. rpc AnalyzeSentiment(AnalyzeSentimentRequest) returns (AnalyzeSentimentResponse) {
  34. option (google.api.http) = {
  35. post: "/v1beta2/documents:analyzeSentiment"
  36. body: "*"
  37. };
  38. option (google.api.method_signature) = "document,encoding_type";
  39. option (google.api.method_signature) = "document";
  40. }
  41. // Finds named entities (currently proper names and common nouns) in the text
  42. // along with entity types, salience, mentions for each entity, and
  43. // other properties.
  44. rpc AnalyzeEntities(AnalyzeEntitiesRequest) returns (AnalyzeEntitiesResponse) {
  45. option (google.api.http) = {
  46. post: "/v1beta2/documents:analyzeEntities"
  47. body: "*"
  48. };
  49. option (google.api.method_signature) = "document,encoding_type";
  50. option (google.api.method_signature) = "document";
  51. }
  52. // Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] in the text and analyzes
  53. // sentiment associated with each entity and its mentions.
  54. rpc AnalyzeEntitySentiment(AnalyzeEntitySentimentRequest) returns (AnalyzeEntitySentimentResponse) {
  55. option (google.api.http) = {
  56. post: "/v1beta2/documents:analyzeEntitySentiment"
  57. body: "*"
  58. };
  59. option (google.api.method_signature) = "document,encoding_type";
  60. option (google.api.method_signature) = "document";
  61. }
  62. // Analyzes the syntax of the text and provides sentence boundaries and
  63. // tokenization along with part-of-speech tags, dependency trees, and other
  64. // properties.
  65. rpc AnalyzeSyntax(AnalyzeSyntaxRequest) returns (AnalyzeSyntaxResponse) {
  66. option (google.api.http) = {
  67. post: "/v1beta2/documents:analyzeSyntax"
  68. body: "*"
  69. };
  70. option (google.api.method_signature) = "document,encoding_type";
  71. option (google.api.method_signature) = "document";
  72. }
  73. // Classifies a document into categories.
  74. rpc ClassifyText(ClassifyTextRequest) returns (ClassifyTextResponse) {
  75. option (google.api.http) = {
  76. post: "/v1beta2/documents:classifyText"
  77. body: "*"
  78. };
  79. option (google.api.method_signature) = "document";
  80. }
  81. // A convenience method that provides all syntax, sentiment, entity, and
  82. // classification features in one call.
  83. rpc AnnotateText(AnnotateTextRequest) returns (AnnotateTextResponse) {
  84. option (google.api.http) = {
  85. post: "/v1beta2/documents:annotateText"
  86. body: "*"
  87. };
  88. option (google.api.method_signature) = "document,features,encoding_type";
  89. option (google.api.method_signature) = "document,features";
  90. }
  91. }
  92. //
  93. // Represents the input to API methods.
  94. message Document {
  95. // The document types enum.
  96. enum Type {
  97. // The content type is not specified.
  98. TYPE_UNSPECIFIED = 0;
  99. // Plain text
  100. PLAIN_TEXT = 1;
  101. // HTML
  102. HTML = 2;
  103. }
  104. // Required. If the type is not set or is `TYPE_UNSPECIFIED`,
  105. // returns an `INVALID_ARGUMENT` error.
  106. Type type = 1;
  107. // The source of the document: a string containing the content or a
  108. // Google Cloud Storage URI.
  109. oneof source {
  110. // The content of the input in string format.
  111. // Cloud audit logging exempt since it is based on user data.
  112. string content = 2;
  113. // The Google Cloud Storage URI where the file content is located.
  114. // This URI must be of the form: gs://bucket_name/object_name. For more
  115. // details, see https://cloud.google.com/storage/docs/reference-uris.
  116. // NOTE: Cloud Storage object versioning is not supported.
  117. string gcs_content_uri = 3;
  118. }
  119. // The language of the document (if not specified, the language is
  120. // automatically detected). Both ISO and BCP-47 language codes are
  121. // accepted.<br>
  122. // [Language
  123. // Support](https://cloud.google.com/natural-language/docs/languages) lists
  124. // currently supported languages for each API method. If the language (either
  125. // specified by the caller or automatically detected) is not supported by the
  126. // called API method, an `INVALID_ARGUMENT` error is returned.
  127. string language = 4;
  128. }
  129. // Represents a sentence in the input document.
  130. message Sentence {
  131. // The sentence text.
  132. TextSpan text = 1;
  133. // For calls to [AnalyzeSentiment][] or if
  134. // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment] is set to
  135. // true, this field will contain the sentiment for the sentence.
  136. Sentiment sentiment = 2;
  137. }
  138. // Represents a phrase in the text that is a known entity, such as
  139. // a person, an organization, or location. The API associates information, such
  140. // as salience and mentions, with entities.
  141. message Entity {
  142. // The type of the entity. For most entity types, the associated metadata is a
  143. // Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table
  144. // below lists the associated fields for entities that have different
  145. // metadata.
  146. enum Type {
  147. // Unknown
  148. UNKNOWN = 0;
  149. // Person
  150. PERSON = 1;
  151. // Location
  152. LOCATION = 2;
  153. // Organization
  154. ORGANIZATION = 3;
  155. // Event
  156. EVENT = 4;
  157. // Artwork
  158. WORK_OF_ART = 5;
  159. // Consumer product
  160. CONSUMER_GOOD = 6;
  161. // Other types of entities
  162. OTHER = 7;
  163. // Phone number
  164. //
  165. // The metadata lists the phone number, formatted according to local
  166. // convention, plus whichever additional elements appear in the text:
  167. //
  168. // * `number` - the actual number, broken down into sections as per local
  169. // convention
  170. // * `national_prefix` - country code, if detected
  171. // * `area_code` - region or area code, if detected
  172. // * `extension` - phone extension (to be dialed after connection), if
  173. // detected
  174. PHONE_NUMBER = 9;
  175. // Address
  176. //
  177. // The metadata identifies the street number and locality plus whichever
  178. // additional elements appear in the text:
  179. //
  180. // * `street_number` - street number
  181. // * `locality` - city or town
  182. // * `street_name` - street/route name, if detected
  183. // * `postal_code` - postal code, if detected
  184. // * `country` - country, if detected<
  185. // * `broad_region` - administrative area, such as the state, if detected
  186. // * `narrow_region` - smaller administrative area, such as county, if
  187. // detected
  188. // * `sublocality` - used in Asian addresses to demark a district within a
  189. // city, if detected
  190. ADDRESS = 10;
  191. // Date
  192. //
  193. // The metadata identifies the components of the date:
  194. //
  195. // * `year` - four digit year, if detected
  196. // * `month` - two digit month number, if detected
  197. // * `day` - two digit day number, if detected
  198. DATE = 11;
  199. // Number
  200. //
  201. // The metadata is the number itself.
  202. NUMBER = 12;
  203. // Price
  204. //
  205. // The metadata identifies the `value` and `currency`.
  206. PRICE = 13;
  207. }
  208. // The representative name for the entity.
  209. string name = 1;
  210. // The entity type.
  211. Type type = 2;
  212. // Metadata associated with the entity.
  213. //
  214. // For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`)
  215. // and Knowledge Graph MID (`mid`), if they are available. For the metadata
  216. // associated with other entity types, see the Type table below.
  217. map<string, string> metadata = 3;
  218. // The salience score associated with the entity in the [0, 1.0] range.
  219. //
  220. // The salience score for an entity provides information about the
  221. // importance or centrality of that entity to the entire document text.
  222. // Scores closer to 0 are less salient, while scores closer to 1.0 are highly
  223. // salient.
  224. float salience = 4;
  225. // The mentions of this entity in the input document. The API currently
  226. // supports proper noun mentions.
  227. repeated EntityMention mentions = 5;
  228. // For calls to [AnalyzeEntitySentiment][] or if
  229. // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to
  230. // true, this field will contain the aggregate sentiment expressed for this
  231. // entity in the provided document.
  232. Sentiment sentiment = 6;
  233. }
  234. // Represents the smallest syntactic building block of the text.
  235. message Token {
  236. // The token text.
  237. TextSpan text = 1;
  238. // Parts of speech tag for this token.
  239. PartOfSpeech part_of_speech = 2;
  240. // Dependency tree parse for this token.
  241. DependencyEdge dependency_edge = 3;
  242. // [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
  243. string lemma = 4;
  244. }
  245. // Represents the text encoding that the caller uses to process the output.
  246. // Providing an `EncodingType` is recommended because the API provides the
  247. // beginning offsets for various outputs, such as tokens and mentions, and
  248. // languages that natively use different text encodings may access offsets
  249. // differently.
  250. enum EncodingType {
  251. // If `EncodingType` is not specified, encoding-dependent information (such as
  252. // `begin_offset`) will be set at `-1`.
  253. NONE = 0;
  254. // Encoding-dependent information (such as `begin_offset`) is calculated based
  255. // on the UTF-8 encoding of the input. C++ and Go are examples of languages
  256. // that use this encoding natively.
  257. UTF8 = 1;
  258. // Encoding-dependent information (such as `begin_offset`) is calculated based
  259. // on the UTF-16 encoding of the input. Java and JavaScript are examples of
  260. // languages that use this encoding natively.
  261. UTF16 = 2;
  262. // Encoding-dependent information (such as `begin_offset`) is calculated based
  263. // on the UTF-32 encoding of the input. Python is an example of a language
  264. // that uses this encoding natively.
  265. UTF32 = 3;
  266. }
  267. // Represents the feeling associated with the entire text or entities in
  268. // the text.
  269. // Next ID: 6
  270. message Sentiment {
  271. // A non-negative number in the [0, +inf) range, which represents
  272. // the absolute magnitude of sentiment regardless of score (positive or
  273. // negative).
  274. float magnitude = 2;
  275. // Sentiment score between -1.0 (negative sentiment) and 1.0
  276. // (positive sentiment).
  277. float score = 3;
  278. }
  279. // Represents part of speech information for a token.
  280. message PartOfSpeech {
  281. // The part of speech tags enum.
  282. enum Tag {
  283. // Unknown
  284. UNKNOWN = 0;
  285. // Adjective
  286. ADJ = 1;
  287. // Adposition (preposition and postposition)
  288. ADP = 2;
  289. // Adverb
  290. ADV = 3;
  291. // Conjunction
  292. CONJ = 4;
  293. // Determiner
  294. DET = 5;
  295. // Noun (common and proper)
  296. NOUN = 6;
  297. // Cardinal number
  298. NUM = 7;
  299. // Pronoun
  300. PRON = 8;
  301. // Particle or other function word
  302. PRT = 9;
  303. // Punctuation
  304. PUNCT = 10;
  305. // Verb (all tenses and modes)
  306. VERB = 11;
  307. // Other: foreign words, typos, abbreviations
  308. X = 12;
  309. // Affix
  310. AFFIX = 13;
  311. }
  312. // The characteristic of a verb that expresses time flow during an event.
  313. enum Aspect {
  314. // Aspect is not applicable in the analyzed language or is not predicted.
  315. ASPECT_UNKNOWN = 0;
  316. // Perfective
  317. PERFECTIVE = 1;
  318. // Imperfective
  319. IMPERFECTIVE = 2;
  320. // Progressive
  321. PROGRESSIVE = 3;
  322. }
  323. // The grammatical function performed by a noun or pronoun in a phrase,
  324. // clause, or sentence. In some languages, other parts of speech, such as
  325. // adjective and determiner, take case inflection in agreement with the noun.
  326. enum Case {
  327. // Case is not applicable in the analyzed language or is not predicted.
  328. CASE_UNKNOWN = 0;
  329. // Accusative
  330. ACCUSATIVE = 1;
  331. // Adverbial
  332. ADVERBIAL = 2;
  333. // Complementive
  334. COMPLEMENTIVE = 3;
  335. // Dative
  336. DATIVE = 4;
  337. // Genitive
  338. GENITIVE = 5;
  339. // Instrumental
  340. INSTRUMENTAL = 6;
  341. // Locative
  342. LOCATIVE = 7;
  343. // Nominative
  344. NOMINATIVE = 8;
  345. // Oblique
  346. OBLIQUE = 9;
  347. // Partitive
  348. PARTITIVE = 10;
  349. // Prepositional
  350. PREPOSITIONAL = 11;
  351. // Reflexive
  352. REFLEXIVE_CASE = 12;
  353. // Relative
  354. RELATIVE_CASE = 13;
  355. // Vocative
  356. VOCATIVE = 14;
  357. }
  358. // Depending on the language, Form can be categorizing different forms of
  359. // verbs, adjectives, adverbs, etc. For example, categorizing inflected
  360. // endings of verbs and adjectives or distinguishing between short and long
  361. // forms of adjectives and participles
  362. enum Form {
  363. // Form is not applicable in the analyzed language or is not predicted.
  364. FORM_UNKNOWN = 0;
  365. // Adnomial
  366. ADNOMIAL = 1;
  367. // Auxiliary
  368. AUXILIARY = 2;
  369. // Complementizer
  370. COMPLEMENTIZER = 3;
  371. // Final ending
  372. FINAL_ENDING = 4;
  373. // Gerund
  374. GERUND = 5;
  375. // Realis
  376. REALIS = 6;
  377. // Irrealis
  378. IRREALIS = 7;
  379. // Short form
  380. SHORT = 8;
  381. // Long form
  382. LONG = 9;
  383. // Order form
  384. ORDER = 10;
  385. // Specific form
  386. SPECIFIC = 11;
  387. }
  388. // Gender classes of nouns reflected in the behaviour of associated words.
  389. enum Gender {
  390. // Gender is not applicable in the analyzed language or is not predicted.
  391. GENDER_UNKNOWN = 0;
  392. // Feminine
  393. FEMININE = 1;
  394. // Masculine
  395. MASCULINE = 2;
  396. // Neuter
  397. NEUTER = 3;
  398. }
  399. // The grammatical feature of verbs, used for showing modality and attitude.
  400. enum Mood {
  401. // Mood is not applicable in the analyzed language or is not predicted.
  402. MOOD_UNKNOWN = 0;
  403. // Conditional
  404. CONDITIONAL_MOOD = 1;
  405. // Imperative
  406. IMPERATIVE = 2;
  407. // Indicative
  408. INDICATIVE = 3;
  409. // Interrogative
  410. INTERROGATIVE = 4;
  411. // Jussive
  412. JUSSIVE = 5;
  413. // Subjunctive
  414. SUBJUNCTIVE = 6;
  415. }
  416. // Count distinctions.
  417. enum Number {
  418. // Number is not applicable in the analyzed language or is not predicted.
  419. NUMBER_UNKNOWN = 0;
  420. // Singular
  421. SINGULAR = 1;
  422. // Plural
  423. PLURAL = 2;
  424. // Dual
  425. DUAL = 3;
  426. }
  427. // The distinction between the speaker, second person, third person, etc.
  428. enum Person {
  429. // Person is not applicable in the analyzed language or is not predicted.
  430. PERSON_UNKNOWN = 0;
  431. // First
  432. FIRST = 1;
  433. // Second
  434. SECOND = 2;
  435. // Third
  436. THIRD = 3;
  437. // Reflexive
  438. REFLEXIVE_PERSON = 4;
  439. }
  440. // This category shows if the token is part of a proper name.
  441. enum Proper {
  442. // Proper is not applicable in the analyzed language or is not predicted.
  443. PROPER_UNKNOWN = 0;
  444. // Proper
  445. PROPER = 1;
  446. // Not proper
  447. NOT_PROPER = 2;
  448. }
  449. // Reciprocal features of a pronoun.
  450. enum Reciprocity {
  451. // Reciprocity is not applicable in the analyzed language or is not
  452. // predicted.
  453. RECIPROCITY_UNKNOWN = 0;
  454. // Reciprocal
  455. RECIPROCAL = 1;
  456. // Non-reciprocal
  457. NON_RECIPROCAL = 2;
  458. }
  459. // Time reference.
  460. enum Tense {
  461. // Tense is not applicable in the analyzed language or is not predicted.
  462. TENSE_UNKNOWN = 0;
  463. // Conditional
  464. CONDITIONAL_TENSE = 1;
  465. // Future
  466. FUTURE = 2;
  467. // Past
  468. PAST = 3;
  469. // Present
  470. PRESENT = 4;
  471. // Imperfect
  472. IMPERFECT = 5;
  473. // Pluperfect
  474. PLUPERFECT = 6;
  475. }
  476. // The relationship between the action that a verb expresses and the
  477. // participants identified by its arguments.
  478. enum Voice {
  479. // Voice is not applicable in the analyzed language or is not predicted.
  480. VOICE_UNKNOWN = 0;
  481. // Active
  482. ACTIVE = 1;
  483. // Causative
  484. CAUSATIVE = 2;
  485. // Passive
  486. PASSIVE = 3;
  487. }
  488. // The part of speech tag.
  489. Tag tag = 1;
  490. // The grammatical aspect.
  491. Aspect aspect = 2;
  492. // The grammatical case.
  493. Case case = 3;
  494. // The grammatical form.
  495. Form form = 4;
  496. // The grammatical gender.
  497. Gender gender = 5;
  498. // The grammatical mood.
  499. Mood mood = 6;
  500. // The grammatical number.
  501. Number number = 7;
  502. // The grammatical person.
  503. Person person = 8;
  504. // The grammatical properness.
  505. Proper proper = 9;
  506. // The grammatical reciprocity.
  507. Reciprocity reciprocity = 10;
  508. // The grammatical tense.
  509. Tense tense = 11;
  510. // The grammatical voice.
  511. Voice voice = 12;
  512. }
  513. // Represents dependency parse tree information for a token.
  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.v1beta2.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.v1beta2.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. // The sentiment analysis request message.
  733. message AnalyzeSentimentRequest {
  734. // Required. Input document.
  735. Document document = 1 [(google.api.field_behavior) = REQUIRED];
  736. // The encoding type used by the API to calculate sentence offsets for the
  737. // sentence sentiment.
  738. EncodingType encoding_type = 2;
  739. }
  740. // The sentiment analysis response message.
  741. message AnalyzeSentimentResponse {
  742. // The overall sentiment of the input document.
  743. Sentiment document_sentiment = 1;
  744. // The language of the text, which will be the same as the language specified
  745. // in the request or, if not specified, the automatically-detected language.
  746. // See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details.
  747. string language = 2;
  748. // The sentiment for all the sentences in the document.
  749. repeated Sentence sentences = 3;
  750. }
  751. // The entity-level sentiment analysis request message.
  752. message AnalyzeEntitySentimentRequest {
  753. // Required. Input document.
  754. Document document = 1 [(google.api.field_behavior) = REQUIRED];
  755. // The encoding type used by the API to calculate offsets.
  756. EncodingType encoding_type = 2;
  757. }
  758. // The entity-level sentiment analysis response message.
  759. message AnalyzeEntitySentimentResponse {
  760. // The recognized entities in the input document with associated sentiments.
  761. repeated Entity entities = 1;
  762. // The language of the text, which will be the same as the language specified
  763. // in the request or, if not specified, the automatically-detected language.
  764. // See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details.
  765. string language = 2;
  766. }
  767. // The entity analysis request message.
  768. message AnalyzeEntitiesRequest {
  769. // Required. Input document.
  770. Document document = 1 [(google.api.field_behavior) = REQUIRED];
  771. // The encoding type used by the API to calculate offsets.
  772. EncodingType encoding_type = 2;
  773. }
  774. // The entity analysis response message.
  775. message AnalyzeEntitiesResponse {
  776. // The recognized entities in the input document.
  777. repeated Entity entities = 1;
  778. // The language of the text, which will be the same as the language specified
  779. // in the request or, if not specified, the automatically-detected language.
  780. // See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details.
  781. string language = 2;
  782. }
  783. // The syntax analysis request message.
  784. message AnalyzeSyntaxRequest {
  785. // Required. Input document.
  786. Document document = 1 [(google.api.field_behavior) = REQUIRED];
  787. // The encoding type used by the API to calculate offsets.
  788. EncodingType encoding_type = 2;
  789. }
  790. // The syntax analysis response message.
  791. message AnalyzeSyntaxResponse {
  792. // Sentences in the input document.
  793. repeated Sentence sentences = 1;
  794. // Tokens, along with their syntactic information, in the input document.
  795. repeated Token tokens = 2;
  796. // The language of the text, which will be the same as the language specified
  797. // in the request or, if not specified, the automatically-detected language.
  798. // See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details.
  799. string language = 3;
  800. }
  801. // The document classification request message.
  802. message ClassifyTextRequest {
  803. // Required. Input document.
  804. Document document = 1 [(google.api.field_behavior) = REQUIRED];
  805. }
  806. // The document classification response message.
  807. message ClassifyTextResponse {
  808. // Categories representing the input document.
  809. repeated ClassificationCategory categories = 1;
  810. }
  811. // The request message for the text annotation API, which can perform multiple
  812. // analysis types (sentiment, entities, and syntax) in one call.
  813. message AnnotateTextRequest {
  814. // All available features for sentiment, syntax, and semantic analysis.
  815. // Setting each one to true will enable that specific analysis for the input.
  816. // Next ID: 10
  817. message Features {
  818. // Extract syntax information.
  819. bool extract_syntax = 1;
  820. // Extract entities.
  821. bool extract_entities = 2;
  822. // Extract document-level sentiment.
  823. bool extract_document_sentiment = 3;
  824. // Extract entities and their associated sentiment.
  825. bool extract_entity_sentiment = 4;
  826. // Classify the full document into categories. If this is true,
  827. // the API will use the default model which classifies into a
  828. // [predefined
  829. // taxonomy](https://cloud.google.com/natural-language/docs/categories).
  830. bool classify_text = 6;
  831. }
  832. // Required. Input document.
  833. Document document = 1 [(google.api.field_behavior) = REQUIRED];
  834. // Required. The enabled features.
  835. Features features = 2 [(google.api.field_behavior) = REQUIRED];
  836. // The encoding type used by the API to calculate offsets.
  837. EncodingType encoding_type = 3;
  838. }
  839. // The text annotations response message.
  840. message AnnotateTextResponse {
  841. // Sentences in the input document. Populated if the user enables
  842. // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax].
  843. repeated Sentence sentences = 1;
  844. // Tokens, along with their syntactic information, in the input document.
  845. // Populated if the user enables
  846. // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax].
  847. repeated Token tokens = 2;
  848. // Entities, along with their semantic information, in the input document.
  849. // Populated if the user enables
  850. // [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entities].
  851. repeated Entity entities = 3;
  852. // The overall sentiment for the document. Populated if the user enables
  853. // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment].
  854. Sentiment document_sentiment = 4;
  855. // The language of the text, which will be the same as the language specified
  856. // in the request or, if not specified, the automatically-detected language.
  857. // See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details.
  858. string language = 5;
  859. // Categories identified in the input document.
  860. repeated ClassificationCategory categories = 6;
  861. }