| OLD | NEW |
| (Empty) | |
| 1 // This is a generated file (see the discoveryapis_generator project). |
| 2 |
| 3 library googleapis_beta.language.v1beta1; |
| 4 |
| 5 import 'dart:core' as core; |
| 6 import 'dart:async' as async; |
| 7 import 'dart:convert' as convert; |
| 8 |
| 9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; |
| 10 import 'package:http/http.dart' as http; |
| 11 |
| 12 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show |
| 13 ApiRequestError, DetailedApiRequestError; |
| 14 |
| 15 const core.String USER_AGENT = 'dart-api-client language/v1beta1'; |
| 16 |
| 17 /** |
| 18 * Google Cloud Natural Language API provides natural language understanding |
| 19 * technologies to developers. Examples include sentiment analysis, entity |
| 20 * recognition, and text annotations. |
| 21 */ |
| 22 class LanguageApi { |
| 23 /** View and manage your data across Google Cloud Platform services */ |
| 24 static const CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platf
orm"; |
| 25 |
| 26 |
| 27 final commons.ApiRequester _requester; |
| 28 |
| 29 DocumentsResourceApi get documents => new DocumentsResourceApi(_requester); |
| 30 |
| 31 LanguageApi(http.Client client, {core.String rootUrl: "https://language.google
apis.com/", core.String servicePath: ""}) : |
| 32 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); |
| 33 } |
| 34 |
| 35 |
| 36 class DocumentsResourceApi { |
| 37 final commons.ApiRequester _requester; |
| 38 |
| 39 DocumentsResourceApi(commons.ApiRequester client) : |
| 40 _requester = client; |
| 41 |
| 42 /** |
| 43 * Finds named entities (currently finds proper names) in the text, |
| 44 * entity types, salience, mentions for each entity, and other properties. |
| 45 * |
| 46 * [request] - The metadata request object. |
| 47 * |
| 48 * Request parameters: |
| 49 * |
| 50 * Completes with a [AnalyzeEntitiesResponse]. |
| 51 * |
| 52 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 53 * error. |
| 54 * |
| 55 * If the used [http.Client] completes with an error when making a REST call, |
| 56 * this method will complete with the same error. |
| 57 */ |
| 58 async.Future<AnalyzeEntitiesResponse> analyzeEntities(AnalyzeEntitiesRequest r
equest) { |
| 59 var _url = null; |
| 60 var _queryParams = new core.Map(); |
| 61 var _uploadMedia = null; |
| 62 var _uploadOptions = null; |
| 63 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 64 var _body = null; |
| 65 |
| 66 if (request != null) { |
| 67 _body = convert.JSON.encode((request).toJson()); |
| 68 } |
| 69 |
| 70 _url = 'v1beta1/documents:analyzeEntities'; |
| 71 |
| 72 var _response = _requester.request(_url, |
| 73 "POST", |
| 74 body: _body, |
| 75 queryParams: _queryParams, |
| 76 uploadOptions: _uploadOptions, |
| 77 uploadMedia: _uploadMedia, |
| 78 downloadOptions: _downloadOptions); |
| 79 return _response.then((data) => new AnalyzeEntitiesResponse.fromJson(data)); |
| 80 } |
| 81 |
| 82 /** |
| 83 * Analyzes the sentiment of the provided text. |
| 84 * |
| 85 * [request] - The metadata request object. |
| 86 * |
| 87 * Request parameters: |
| 88 * |
| 89 * Completes with a [AnalyzeSentimentResponse]. |
| 90 * |
| 91 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 92 * error. |
| 93 * |
| 94 * If the used [http.Client] completes with an error when making a REST call, |
| 95 * this method will complete with the same error. |
| 96 */ |
| 97 async.Future<AnalyzeSentimentResponse> analyzeSentiment(AnalyzeSentimentReques
t request) { |
| 98 var _url = null; |
| 99 var _queryParams = new core.Map(); |
| 100 var _uploadMedia = null; |
| 101 var _uploadOptions = null; |
| 102 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 103 var _body = null; |
| 104 |
| 105 if (request != null) { |
| 106 _body = convert.JSON.encode((request).toJson()); |
| 107 } |
| 108 |
| 109 _url = 'v1beta1/documents:analyzeSentiment'; |
| 110 |
| 111 var _response = _requester.request(_url, |
| 112 "POST", |
| 113 body: _body, |
| 114 queryParams: _queryParams, |
| 115 uploadOptions: _uploadOptions, |
| 116 uploadMedia: _uploadMedia, |
| 117 downloadOptions: _downloadOptions); |
| 118 return _response.then((data) => new AnalyzeSentimentResponse.fromJson(data))
; |
| 119 } |
| 120 |
| 121 /** |
| 122 * Advanced API that analyzes the document and provides a full set of text |
| 123 * annotations, including semantic, syntactic, and sentiment information. This |
| 124 * API is intended for users who are familiar with machine learning and need |
| 125 * in-depth text features to build upon. |
| 126 * |
| 127 * [request] - The metadata request object. |
| 128 * |
| 129 * Request parameters: |
| 130 * |
| 131 * Completes with a [AnnotateTextResponse]. |
| 132 * |
| 133 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 134 * error. |
| 135 * |
| 136 * If the used [http.Client] completes with an error when making a REST call, |
| 137 * this method will complete with the same error. |
| 138 */ |
| 139 async.Future<AnnotateTextResponse> annotateText(AnnotateTextRequest request) { |
| 140 var _url = null; |
| 141 var _queryParams = new core.Map(); |
| 142 var _uploadMedia = null; |
| 143 var _uploadOptions = null; |
| 144 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 145 var _body = null; |
| 146 |
| 147 if (request != null) { |
| 148 _body = convert.JSON.encode((request).toJson()); |
| 149 } |
| 150 |
| 151 _url = 'v1beta1/documents:annotateText'; |
| 152 |
| 153 var _response = _requester.request(_url, |
| 154 "POST", |
| 155 body: _body, |
| 156 queryParams: _queryParams, |
| 157 uploadOptions: _uploadOptions, |
| 158 uploadMedia: _uploadMedia, |
| 159 downloadOptions: _downloadOptions); |
| 160 return _response.then((data) => new AnnotateTextResponse.fromJson(data)); |
| 161 } |
| 162 |
| 163 } |
| 164 |
| 165 |
| 166 |
| 167 /** The entity analysis request message. */ |
| 168 class AnalyzeEntitiesRequest { |
| 169 /** Input document. */ |
| 170 Document document; |
| 171 /** |
| 172 * The encoding type used by the API to calculate offsets. |
| 173 * Possible string values are: |
| 174 * - "NONE" : If `EncodingType` is not specified, encoding-dependent |
| 175 * information (such as |
| 176 * `begin_offset`) will be set at `-1`. |
| 177 * - "UTF8" : Encoding-dependent information (such as `begin_offset`) is |
| 178 * calculated based |
| 179 * on the UTF-8 encoding of the input. C++ and Go are examples of languages |
| 180 * that use this encoding natively. |
| 181 * - "UTF16" : Encoding-dependent information (such as `begin_offset`) is |
| 182 * calculated based |
| 183 * on the UTF-16 encoding of the input. Java and Javascript are examples of |
| 184 * languages that use this encoding natively. |
| 185 * - "UTF32" : Encoding-dependent information (such as `begin_offset`) is |
| 186 * calculated based |
| 187 * on the UTF-32 encoding of the input. Python is an example of a language |
| 188 * that uses this encoding natively. |
| 189 */ |
| 190 core.String encodingType; |
| 191 |
| 192 AnalyzeEntitiesRequest(); |
| 193 |
| 194 AnalyzeEntitiesRequest.fromJson(core.Map _json) { |
| 195 if (_json.containsKey("document")) { |
| 196 document = new Document.fromJson(_json["document"]); |
| 197 } |
| 198 if (_json.containsKey("encodingType")) { |
| 199 encodingType = _json["encodingType"]; |
| 200 } |
| 201 } |
| 202 |
| 203 core.Map toJson() { |
| 204 var _json = new core.Map(); |
| 205 if (document != null) { |
| 206 _json["document"] = (document).toJson(); |
| 207 } |
| 208 if (encodingType != null) { |
| 209 _json["encodingType"] = encodingType; |
| 210 } |
| 211 return _json; |
| 212 } |
| 213 } |
| 214 |
| 215 /** The entity analysis response message. */ |
| 216 class AnalyzeEntitiesResponse { |
| 217 /** The recognized entities in the input document. */ |
| 218 core.List<Entity> entities; |
| 219 /** |
| 220 * The language of the text, which will be the same as the language specified |
| 221 * in the request or, if not specified, the automatically-detected language. |
| 222 */ |
| 223 core.String language; |
| 224 |
| 225 AnalyzeEntitiesResponse(); |
| 226 |
| 227 AnalyzeEntitiesResponse.fromJson(core.Map _json) { |
| 228 if (_json.containsKey("entities")) { |
| 229 entities = _json["entities"].map((value) => new Entity.fromJson(value)).to
List(); |
| 230 } |
| 231 if (_json.containsKey("language")) { |
| 232 language = _json["language"]; |
| 233 } |
| 234 } |
| 235 |
| 236 core.Map toJson() { |
| 237 var _json = new core.Map(); |
| 238 if (entities != null) { |
| 239 _json["entities"] = entities.map((value) => (value).toJson()).toList(); |
| 240 } |
| 241 if (language != null) { |
| 242 _json["language"] = language; |
| 243 } |
| 244 return _json; |
| 245 } |
| 246 } |
| 247 |
| 248 /** The sentiment analysis request message. */ |
| 249 class AnalyzeSentimentRequest { |
| 250 /** |
| 251 * Input document. Currently, `analyzeSentiment` only supports English text |
| 252 * (Document.language="EN"). |
| 253 */ |
| 254 Document document; |
| 255 |
| 256 AnalyzeSentimentRequest(); |
| 257 |
| 258 AnalyzeSentimentRequest.fromJson(core.Map _json) { |
| 259 if (_json.containsKey("document")) { |
| 260 document = new Document.fromJson(_json["document"]); |
| 261 } |
| 262 } |
| 263 |
| 264 core.Map toJson() { |
| 265 var _json = new core.Map(); |
| 266 if (document != null) { |
| 267 _json["document"] = (document).toJson(); |
| 268 } |
| 269 return _json; |
| 270 } |
| 271 } |
| 272 |
| 273 /** The sentiment analysis response message. */ |
| 274 class AnalyzeSentimentResponse { |
| 275 /** The overall sentiment of the input document. */ |
| 276 Sentiment documentSentiment; |
| 277 /** |
| 278 * The language of the text, which will be the same as the language specified |
| 279 * in the request or, if not specified, the automatically-detected language. |
| 280 */ |
| 281 core.String language; |
| 282 |
| 283 AnalyzeSentimentResponse(); |
| 284 |
| 285 AnalyzeSentimentResponse.fromJson(core.Map _json) { |
| 286 if (_json.containsKey("documentSentiment")) { |
| 287 documentSentiment = new Sentiment.fromJson(_json["documentSentiment"]); |
| 288 } |
| 289 if (_json.containsKey("language")) { |
| 290 language = _json["language"]; |
| 291 } |
| 292 } |
| 293 |
| 294 core.Map toJson() { |
| 295 var _json = new core.Map(); |
| 296 if (documentSentiment != null) { |
| 297 _json["documentSentiment"] = (documentSentiment).toJson(); |
| 298 } |
| 299 if (language != null) { |
| 300 _json["language"] = language; |
| 301 } |
| 302 return _json; |
| 303 } |
| 304 } |
| 305 |
| 306 /** |
| 307 * The request message for the advanced text annotation API, which performs all |
| 308 * the above plus syntactic analysis. |
| 309 */ |
| 310 class AnnotateTextRequest { |
| 311 /** Input document. */ |
| 312 Document document; |
| 313 /** |
| 314 * The encoding type used by the API to calculate offsets. |
| 315 * Possible string values are: |
| 316 * - "NONE" : If `EncodingType` is not specified, encoding-dependent |
| 317 * information (such as |
| 318 * `begin_offset`) will be set at `-1`. |
| 319 * - "UTF8" : Encoding-dependent information (such as `begin_offset`) is |
| 320 * calculated based |
| 321 * on the UTF-8 encoding of the input. C++ and Go are examples of languages |
| 322 * that use this encoding natively. |
| 323 * - "UTF16" : Encoding-dependent information (such as `begin_offset`) is |
| 324 * calculated based |
| 325 * on the UTF-16 encoding of the input. Java and Javascript are examples of |
| 326 * languages that use this encoding natively. |
| 327 * - "UTF32" : Encoding-dependent information (such as `begin_offset`) is |
| 328 * calculated based |
| 329 * on the UTF-32 encoding of the input. Python is an example of a language |
| 330 * that uses this encoding natively. |
| 331 */ |
| 332 core.String encodingType; |
| 333 /** The enabled features. */ |
| 334 Features features; |
| 335 |
| 336 AnnotateTextRequest(); |
| 337 |
| 338 AnnotateTextRequest.fromJson(core.Map _json) { |
| 339 if (_json.containsKey("document")) { |
| 340 document = new Document.fromJson(_json["document"]); |
| 341 } |
| 342 if (_json.containsKey("encodingType")) { |
| 343 encodingType = _json["encodingType"]; |
| 344 } |
| 345 if (_json.containsKey("features")) { |
| 346 features = new Features.fromJson(_json["features"]); |
| 347 } |
| 348 } |
| 349 |
| 350 core.Map toJson() { |
| 351 var _json = new core.Map(); |
| 352 if (document != null) { |
| 353 _json["document"] = (document).toJson(); |
| 354 } |
| 355 if (encodingType != null) { |
| 356 _json["encodingType"] = encodingType; |
| 357 } |
| 358 if (features != null) { |
| 359 _json["features"] = (features).toJson(); |
| 360 } |
| 361 return _json; |
| 362 } |
| 363 } |
| 364 |
| 365 /** The text annotations response message. */ |
| 366 class AnnotateTextResponse { |
| 367 /** |
| 368 * The overall sentiment for the document. Populated if the user enables |
| 369 * AnnotateTextRequest.Features.extract_document_sentiment. |
| 370 */ |
| 371 Sentiment documentSentiment; |
| 372 /** |
| 373 * Entities, along with their semantic information, in the input document. |
| 374 * Populated if the user enables |
| 375 * AnnotateTextRequest.Features.extract_entities. |
| 376 */ |
| 377 core.List<Entity> entities; |
| 378 /** |
| 379 * The language of the text, which will be the same as the language specified |
| 380 * in the request or, if not specified, the automatically-detected language. |
| 381 */ |
| 382 core.String language; |
| 383 /** |
| 384 * Sentences in the input document. Populated if the user enables |
| 385 * AnnotateTextRequest.Features.extract_syntax. |
| 386 */ |
| 387 core.List<Sentence> sentences; |
| 388 /** |
| 389 * Tokens, along with their syntactic information, in the input document. |
| 390 * Populated if the user enables |
| 391 * AnnotateTextRequest.Features.extract_syntax. |
| 392 */ |
| 393 core.List<Token> tokens; |
| 394 |
| 395 AnnotateTextResponse(); |
| 396 |
| 397 AnnotateTextResponse.fromJson(core.Map _json) { |
| 398 if (_json.containsKey("documentSentiment")) { |
| 399 documentSentiment = new Sentiment.fromJson(_json["documentSentiment"]); |
| 400 } |
| 401 if (_json.containsKey("entities")) { |
| 402 entities = _json["entities"].map((value) => new Entity.fromJson(value)).to
List(); |
| 403 } |
| 404 if (_json.containsKey("language")) { |
| 405 language = _json["language"]; |
| 406 } |
| 407 if (_json.containsKey("sentences")) { |
| 408 sentences = _json["sentences"].map((value) => new Sentence.fromJson(value)
).toList(); |
| 409 } |
| 410 if (_json.containsKey("tokens")) { |
| 411 tokens = _json["tokens"].map((value) => new Token.fromJson(value)).toList(
); |
| 412 } |
| 413 } |
| 414 |
| 415 core.Map toJson() { |
| 416 var _json = new core.Map(); |
| 417 if (documentSentiment != null) { |
| 418 _json["documentSentiment"] = (documentSentiment).toJson(); |
| 419 } |
| 420 if (entities != null) { |
| 421 _json["entities"] = entities.map((value) => (value).toJson()).toList(); |
| 422 } |
| 423 if (language != null) { |
| 424 _json["language"] = language; |
| 425 } |
| 426 if (sentences != null) { |
| 427 _json["sentences"] = sentences.map((value) => (value).toJson()).toList(); |
| 428 } |
| 429 if (tokens != null) { |
| 430 _json["tokens"] = tokens.map((value) => (value).toJson()).toList(); |
| 431 } |
| 432 return _json; |
| 433 } |
| 434 } |
| 435 |
| 436 /** Represents dependency parse tree information for a token. */ |
| 437 class DependencyEdge { |
| 438 /** |
| 439 * Represents the head of this token in the dependency tree. |
| 440 * This is the index of the token which has an arc going to this token. |
| 441 * The index is the position of the token in the array of tokens returned |
| 442 * by the API method. If this token is a root token, then the |
| 443 * `head_token_index` is its own index. |
| 444 */ |
| 445 core.int headTokenIndex; |
| 446 /** |
| 447 * The parse label for the token. |
| 448 * Possible string values are: |
| 449 * - "UNKNOWN" : Unknown |
| 450 * - "ABBREV" : Abbreviation modifier |
| 451 * - "ACOMP" : Adjectival complement |
| 452 * - "ADVCL" : Adverbial clause modifier |
| 453 * - "ADVMOD" : Adverbial modifier |
| 454 * - "AMOD" : Adjectival modifier of an NP |
| 455 * - "APPOS" : Appositional modifier of an NP |
| 456 * - "ATTR" : Attribute dependent of a copular verb |
| 457 * - "AUX" : Auxiliary (non-main) verb |
| 458 * - "AUXPASS" : Passive auxiliary |
| 459 * - "CC" : Coordinating conjunction |
| 460 * - "CCOMP" : Clausal complement of a verb or adjective |
| 461 * - "CONJ" : Conjunct |
| 462 * - "CSUBJ" : Clausal subject |
| 463 * - "CSUBJPASS" : Clausal passive subject |
| 464 * - "DEP" : Dependency (unable to determine) |
| 465 * - "DET" : Determiner |
| 466 * - "DISCOURSE" : Discourse |
| 467 * - "DOBJ" : Direct object |
| 468 * - "EXPL" : Expletive |
| 469 * - "GOESWITH" : Goes with (part of a word in a text not well edited) |
| 470 * - "IOBJ" : Indirect object |
| 471 * - "MARK" : Marker (word introducing a subordinate clause) |
| 472 * - "MWE" : Multi-word expression |
| 473 * - "MWV" : Multi-word verbal expression |
| 474 * - "NEG" : Negation modifier |
| 475 * - "NN" : Noun compound modifier |
| 476 * - "NPADVMOD" : Noun phrase used as an adverbial modifier |
| 477 * - "NSUBJ" : Nominal subject |
| 478 * - "NSUBJPASS" : Passive nominal subject |
| 479 * - "NUM" : Numeric modifier of a noun |
| 480 * - "NUMBER" : Element of compound number |
| 481 * - "P" : Punctuation mark |
| 482 * - "PARATAXIS" : Parataxis relation |
| 483 * - "PARTMOD" : Participial modifier |
| 484 * - "PCOMP" : The complement of a preposition is a clause |
| 485 * - "POBJ" : Object of a preposition |
| 486 * - "POSS" : Possession modifier |
| 487 * - "POSTNEG" : Postverbal negative particle |
| 488 * - "PRECOMP" : Predicate complement |
| 489 * - "PRECONJ" : Preconjunt |
| 490 * - "PREDET" : Predeterminer |
| 491 * - "PREF" : Prefix |
| 492 * - "PREP" : Prepositional modifier |
| 493 * - "PRONL" : The relationship between a verb and verbal morpheme |
| 494 * - "PRT" : Particle |
| 495 * - "PS" : Associative or possessive marker |
| 496 * - "QUANTMOD" : Quantifier phrase modifier |
| 497 * - "RCMOD" : Relative clause modifier |
| 498 * - "RCMODREL" : Complementizer in relative clause |
| 499 * - "RDROP" : Ellipsis without a preceding predicate |
| 500 * - "REF" : Referent |
| 501 * - "REMNANT" : Remnant |
| 502 * - "REPARANDUM" : Reparandum |
| 503 * - "ROOT" : Root |
| 504 * - "SNUM" : Suffix specifying a unit of number |
| 505 * - "SUFF" : Suffix |
| 506 * - "TMOD" : Temporal modifier |
| 507 * - "TOPIC" : Topic marker |
| 508 * - "VMOD" : Clause headed by an infinite form of the verb that modifies a |
| 509 * noun |
| 510 * - "VOCATIVE" : Vocative |
| 511 * - "XCOMP" : Open clausal complement |
| 512 * - "SUFFIX" : Name suffix |
| 513 * - "TITLE" : Name title |
| 514 * - "ADVPHMOD" : Adverbial phrase modifier |
| 515 * - "AUXCAUS" : Causative auxiliary |
| 516 * - "AUXVV" : Helper auxiliary |
| 517 * - "DTMOD" : Rentaishi (Prenominal modifier) |
| 518 * - "FOREIGN" : Foreign words |
| 519 * - "KW" : Keyword |
| 520 * - "LIST" : List for chains of comparable items |
| 521 * - "NOMC" : Nominalized clause |
| 522 * - "NOMCSUBJ" : Nominalized clausal subject |
| 523 * - "NOMCSUBJPASS" : Nominalized clausal passive |
| 524 * - "NUMC" : Compound of numeric modifier |
| 525 * - "COP" : Copula |
| 526 * - "DISLOCATED" : Dislocated relation (for fronted/topicalized elements) |
| 527 */ |
| 528 core.String label; |
| 529 |
| 530 DependencyEdge(); |
| 531 |
| 532 DependencyEdge.fromJson(core.Map _json) { |
| 533 if (_json.containsKey("headTokenIndex")) { |
| 534 headTokenIndex = _json["headTokenIndex"]; |
| 535 } |
| 536 if (_json.containsKey("label")) { |
| 537 label = _json["label"]; |
| 538 } |
| 539 } |
| 540 |
| 541 core.Map toJson() { |
| 542 var _json = new core.Map(); |
| 543 if (headTokenIndex != null) { |
| 544 _json["headTokenIndex"] = headTokenIndex; |
| 545 } |
| 546 if (label != null) { |
| 547 _json["label"] = label; |
| 548 } |
| 549 return _json; |
| 550 } |
| 551 } |
| 552 |
| 553 /** |
| 554 * ################################################################ # |
| 555 * |
| 556 * Represents the input to API methods. |
| 557 */ |
| 558 class Document { |
| 559 /** The content of the input in string format. */ |
| 560 core.String content; |
| 561 /** The Google Cloud Storage URI where the file content is located. */ |
| 562 core.String gcsContentUri; |
| 563 /** |
| 564 * The language of the document (if not specified, the language is |
| 565 * automatically detected). Both ISO and BCP-47 language codes are |
| 566 * accepted.<br> |
| 567 * **Current Language Restrictions:** |
| 568 * |
| 569 * * Only English, Spanish, and Japanese textual content |
| 570 * are supported, with the following additional restriction: |
| 571 * * `analyzeSentiment` only supports English text. |
| 572 * If the language (either specified by the caller or automatically detected) |
| 573 * is not supported by the called API method, an `INVALID_ARGUMENT` error |
| 574 * is returned. |
| 575 */ |
| 576 core.String language; |
| 577 /** |
| 578 * Required. If the type is not set or is `TYPE_UNSPECIFIED`, |
| 579 * returns an `INVALID_ARGUMENT` error. |
| 580 * Possible string values are: |
| 581 * - "TYPE_UNSPECIFIED" : The content type is not specified. |
| 582 * - "PLAIN_TEXT" : Plain text |
| 583 * - "HTML" : HTML |
| 584 */ |
| 585 core.String type; |
| 586 |
| 587 Document(); |
| 588 |
| 589 Document.fromJson(core.Map _json) { |
| 590 if (_json.containsKey("content")) { |
| 591 content = _json["content"]; |
| 592 } |
| 593 if (_json.containsKey("gcsContentUri")) { |
| 594 gcsContentUri = _json["gcsContentUri"]; |
| 595 } |
| 596 if (_json.containsKey("language")) { |
| 597 language = _json["language"]; |
| 598 } |
| 599 if (_json.containsKey("type")) { |
| 600 type = _json["type"]; |
| 601 } |
| 602 } |
| 603 |
| 604 core.Map toJson() { |
| 605 var _json = new core.Map(); |
| 606 if (content != null) { |
| 607 _json["content"] = content; |
| 608 } |
| 609 if (gcsContentUri != null) { |
| 610 _json["gcsContentUri"] = gcsContentUri; |
| 611 } |
| 612 if (language != null) { |
| 613 _json["language"] = language; |
| 614 } |
| 615 if (type != null) { |
| 616 _json["type"] = type; |
| 617 } |
| 618 return _json; |
| 619 } |
| 620 } |
| 621 |
| 622 /** |
| 623 * Represents a phrase in the text that is a known entity, such as |
| 624 * a person, an organization, or location. The API associates information, such |
| 625 * as salience and mentions, with entities. |
| 626 */ |
| 627 class Entity { |
| 628 /** |
| 629 * The mentions of this entity in the input document. The API currently |
| 630 * supports proper noun mentions. |
| 631 */ |
| 632 core.List<EntityMention> mentions; |
| 633 /** |
| 634 * Metadata associated with the entity. |
| 635 * |
| 636 * Currently, only Wikipedia URLs are provided, if available. |
| 637 * The associated key is "wikipedia_url". |
| 638 */ |
| 639 core.Map<core.String, core.String> metadata; |
| 640 /** The representative name for the entity. */ |
| 641 core.String name; |
| 642 /** |
| 643 * The salience score associated with the entity in the [0, 1.0] range. |
| 644 * |
| 645 * The salience score for an entity provides information about the |
| 646 * importance or centrality of that entity to the entire document text. |
| 647 * Scores closer to 0 are less salient, while scores closer to 1.0 are highly |
| 648 * salient. |
| 649 */ |
| 650 core.double salience; |
| 651 /** |
| 652 * The entity type. |
| 653 * Possible string values are: |
| 654 * - "UNKNOWN" : Unknown |
| 655 * - "PERSON" : Person |
| 656 * - "LOCATION" : Location |
| 657 * - "ORGANIZATION" : Organization |
| 658 * - "EVENT" : Event |
| 659 * - "WORK_OF_ART" : Work of art |
| 660 * - "CONSUMER_GOOD" : Consumer goods |
| 661 * - "OTHER" : Other types |
| 662 */ |
| 663 core.String type; |
| 664 |
| 665 Entity(); |
| 666 |
| 667 Entity.fromJson(core.Map _json) { |
| 668 if (_json.containsKey("mentions")) { |
| 669 mentions = _json["mentions"].map((value) => new EntityMention.fromJson(val
ue)).toList(); |
| 670 } |
| 671 if (_json.containsKey("metadata")) { |
| 672 metadata = _json["metadata"]; |
| 673 } |
| 674 if (_json.containsKey("name")) { |
| 675 name = _json["name"]; |
| 676 } |
| 677 if (_json.containsKey("salience")) { |
| 678 salience = _json["salience"]; |
| 679 } |
| 680 if (_json.containsKey("type")) { |
| 681 type = _json["type"]; |
| 682 } |
| 683 } |
| 684 |
| 685 core.Map toJson() { |
| 686 var _json = new core.Map(); |
| 687 if (mentions != null) { |
| 688 _json["mentions"] = mentions.map((value) => (value).toJson()).toList(); |
| 689 } |
| 690 if (metadata != null) { |
| 691 _json["metadata"] = metadata; |
| 692 } |
| 693 if (name != null) { |
| 694 _json["name"] = name; |
| 695 } |
| 696 if (salience != null) { |
| 697 _json["salience"] = salience; |
| 698 } |
| 699 if (type != null) { |
| 700 _json["type"] = type; |
| 701 } |
| 702 return _json; |
| 703 } |
| 704 } |
| 705 |
| 706 /** |
| 707 * Represents a mention for an entity in the text. Currently, proper noun |
| 708 * mentions are supported. |
| 709 */ |
| 710 class EntityMention { |
| 711 /** The mention text. */ |
| 712 TextSpan text; |
| 713 |
| 714 EntityMention(); |
| 715 |
| 716 EntityMention.fromJson(core.Map _json) { |
| 717 if (_json.containsKey("text")) { |
| 718 text = new TextSpan.fromJson(_json["text"]); |
| 719 } |
| 720 } |
| 721 |
| 722 core.Map toJson() { |
| 723 var _json = new core.Map(); |
| 724 if (text != null) { |
| 725 _json["text"] = (text).toJson(); |
| 726 } |
| 727 return _json; |
| 728 } |
| 729 } |
| 730 |
| 731 /** |
| 732 * All available features for sentiment, syntax, and semantic analysis. |
| 733 * Setting each one to true will enable that specific analysis for the input. |
| 734 */ |
| 735 class Features { |
| 736 /** Extract document-level sentiment. */ |
| 737 core.bool extractDocumentSentiment; |
| 738 /** Extract entities. */ |
| 739 core.bool extractEntities; |
| 740 /** Extract syntax information. */ |
| 741 core.bool extractSyntax; |
| 742 |
| 743 Features(); |
| 744 |
| 745 Features.fromJson(core.Map _json) { |
| 746 if (_json.containsKey("extractDocumentSentiment")) { |
| 747 extractDocumentSentiment = _json["extractDocumentSentiment"]; |
| 748 } |
| 749 if (_json.containsKey("extractEntities")) { |
| 750 extractEntities = _json["extractEntities"]; |
| 751 } |
| 752 if (_json.containsKey("extractSyntax")) { |
| 753 extractSyntax = _json["extractSyntax"]; |
| 754 } |
| 755 } |
| 756 |
| 757 core.Map toJson() { |
| 758 var _json = new core.Map(); |
| 759 if (extractDocumentSentiment != null) { |
| 760 _json["extractDocumentSentiment"] = extractDocumentSentiment; |
| 761 } |
| 762 if (extractEntities != null) { |
| 763 _json["extractEntities"] = extractEntities; |
| 764 } |
| 765 if (extractSyntax != null) { |
| 766 _json["extractSyntax"] = extractSyntax; |
| 767 } |
| 768 return _json; |
| 769 } |
| 770 } |
| 771 |
| 772 /** Represents part of speech information for a token. */ |
| 773 class PartOfSpeech { |
| 774 /** |
| 775 * The part of speech tag. |
| 776 * Possible string values are: |
| 777 * - "UNKNOWN" : Unknown |
| 778 * - "ADJ" : Adjective |
| 779 * - "ADP" : Adposition (preposition and postposition) |
| 780 * - "ADV" : Adverb |
| 781 * - "CONJ" : Conjunction |
| 782 * - "DET" : Determiner |
| 783 * - "NOUN" : Noun (common and proper) |
| 784 * - "NUM" : Cardinal number |
| 785 * - "PRON" : Pronoun |
| 786 * - "PRT" : Particle or other function word |
| 787 * - "PUNCT" : Punctuation |
| 788 * - "VERB" : Verb (all tenses and modes) |
| 789 * - "X" : Other: foreign words, typos, abbreviations |
| 790 * - "AFFIX" : Affix |
| 791 */ |
| 792 core.String tag; |
| 793 |
| 794 PartOfSpeech(); |
| 795 |
| 796 PartOfSpeech.fromJson(core.Map _json) { |
| 797 if (_json.containsKey("tag")) { |
| 798 tag = _json["tag"]; |
| 799 } |
| 800 } |
| 801 |
| 802 core.Map toJson() { |
| 803 var _json = new core.Map(); |
| 804 if (tag != null) { |
| 805 _json["tag"] = tag; |
| 806 } |
| 807 return _json; |
| 808 } |
| 809 } |
| 810 |
| 811 /** Represents a sentence in the input document. */ |
| 812 class Sentence { |
| 813 /** The sentence text. */ |
| 814 TextSpan text; |
| 815 |
| 816 Sentence(); |
| 817 |
| 818 Sentence.fromJson(core.Map _json) { |
| 819 if (_json.containsKey("text")) { |
| 820 text = new TextSpan.fromJson(_json["text"]); |
| 821 } |
| 822 } |
| 823 |
| 824 core.Map toJson() { |
| 825 var _json = new core.Map(); |
| 826 if (text != null) { |
| 827 _json["text"] = (text).toJson(); |
| 828 } |
| 829 return _json; |
| 830 } |
| 831 } |
| 832 |
| 833 /** |
| 834 * Represents the feeling associated with the entire text or entities in |
| 835 * the text. |
| 836 */ |
| 837 class Sentiment { |
| 838 /** |
| 839 * A non-negative number in the [0, +inf) range, which represents |
| 840 * the absolute magnitude of sentiment regardless of polarity (positive or |
| 841 * negative). |
| 842 */ |
| 843 core.double magnitude; |
| 844 /** |
| 845 * Polarity of the sentiment in the [-1.0, 1.0] range. Larger numbers |
| 846 * represent more positive sentiments. |
| 847 */ |
| 848 core.double polarity; |
| 849 |
| 850 Sentiment(); |
| 851 |
| 852 Sentiment.fromJson(core.Map _json) { |
| 853 if (_json.containsKey("magnitude")) { |
| 854 magnitude = _json["magnitude"]; |
| 855 } |
| 856 if (_json.containsKey("polarity")) { |
| 857 polarity = _json["polarity"]; |
| 858 } |
| 859 } |
| 860 |
| 861 core.Map toJson() { |
| 862 var _json = new core.Map(); |
| 863 if (magnitude != null) { |
| 864 _json["magnitude"] = magnitude; |
| 865 } |
| 866 if (polarity != null) { |
| 867 _json["polarity"] = polarity; |
| 868 } |
| 869 return _json; |
| 870 } |
| 871 } |
| 872 |
| 873 /** |
| 874 * The `Status` type defines a logical error model that is suitable for |
| 875 * different |
| 876 * programming environments, including REST APIs and RPC APIs. It is used by |
| 877 * [gRPC](https://github.com/grpc). The error model is designed to be: |
| 878 * |
| 879 * - Simple to use and understand for most users |
| 880 * - Flexible enough to meet unexpected needs |
| 881 * |
| 882 * # Overview |
| 883 * |
| 884 * The `Status` message contains three pieces of data: error code, error |
| 885 * message, |
| 886 * and error details. The error code should be an enum value of |
| 887 * google.rpc.Code, but it may accept additional error codes if needed. The |
| 888 * error message should be a developer-facing English message that helps |
| 889 * developers *understand* and *resolve* the error. If a localized user-facing |
| 890 * error message is needed, put the localized message in the error details or |
| 891 * localize it in the client. The optional error details may contain arbitrary |
| 892 * information about the error. There is a predefined set of error detail types |
| 893 * in the package `google.rpc` which can be used for common error conditions. |
| 894 * |
| 895 * # Language mapping |
| 896 * |
| 897 * The `Status` message is the logical representation of the error model, but it |
| 898 * is not necessarily the actual wire format. When the `Status` message is |
| 899 * exposed in different client libraries and different wire protocols, it can be |
| 900 * mapped differently. For example, it will likely be mapped to some exceptions |
| 901 * in Java, but more likely mapped to some error codes in C. |
| 902 * |
| 903 * # Other uses |
| 904 * |
| 905 * The error model and the `Status` message can be used in a variety of |
| 906 * environments, either with or without APIs, to provide a |
| 907 * consistent developer experience across different environments. |
| 908 * |
| 909 * Example uses of this error model include: |
| 910 * |
| 911 * - Partial errors. If a service needs to return partial errors to the client, |
| 912 * it may embed the `Status` in the normal response to indicate the partial |
| 913 * errors. |
| 914 * |
| 915 * - Workflow errors. A typical workflow has multiple steps. Each step may |
| 916 * have a `Status` message for error reporting purpose. |
| 917 * |
| 918 * - Batch operations. If a client uses batch request and batch response, the |
| 919 * `Status` message should be used directly inside batch response, one for |
| 920 * each error sub-response. |
| 921 * |
| 922 * - Asynchronous operations. If an API call embeds asynchronous operation |
| 923 * results in its response, the status of those operations should be |
| 924 * represented directly using the `Status` message. |
| 925 * |
| 926 * - Logging. If some API errors are stored in logs, the message `Status` could |
| 927 * be used directly after any stripping needed for security/privacy reasons. |
| 928 */ |
| 929 class Status { |
| 930 /** The status code, which should be an enum value of google.rpc.Code. */ |
| 931 core.int code; |
| 932 /** |
| 933 * A list of messages that carry the error details. There will be a |
| 934 * common set of message types for APIs to use. |
| 935 * |
| 936 * The values for Object must be JSON objects. It can consist of `num`, |
| 937 * `String`, `bool` and `null` as well as `Map` and `List` values. |
| 938 */ |
| 939 core.List<core.Map<core.String, core.Object>> details; |
| 940 /** |
| 941 * A developer-facing error message, which should be in English. Any |
| 942 * user-facing error message should be localized and sent in the |
| 943 * google.rpc.Status.details field, or localized by the client. |
| 944 */ |
| 945 core.String message; |
| 946 |
| 947 Status(); |
| 948 |
| 949 Status.fromJson(core.Map _json) { |
| 950 if (_json.containsKey("code")) { |
| 951 code = _json["code"]; |
| 952 } |
| 953 if (_json.containsKey("details")) { |
| 954 details = _json["details"]; |
| 955 } |
| 956 if (_json.containsKey("message")) { |
| 957 message = _json["message"]; |
| 958 } |
| 959 } |
| 960 |
| 961 core.Map toJson() { |
| 962 var _json = new core.Map(); |
| 963 if (code != null) { |
| 964 _json["code"] = code; |
| 965 } |
| 966 if (details != null) { |
| 967 _json["details"] = details; |
| 968 } |
| 969 if (message != null) { |
| 970 _json["message"] = message; |
| 971 } |
| 972 return _json; |
| 973 } |
| 974 } |
| 975 |
| 976 /** Represents an output piece of text. */ |
| 977 class TextSpan { |
| 978 /** |
| 979 * The API calculates the beginning offset of the content in the original |
| 980 * document according to the EncodingType specified in the API request. |
| 981 */ |
| 982 core.int beginOffset; |
| 983 /** The content of the output text. */ |
| 984 core.String content; |
| 985 |
| 986 TextSpan(); |
| 987 |
| 988 TextSpan.fromJson(core.Map _json) { |
| 989 if (_json.containsKey("beginOffset")) { |
| 990 beginOffset = _json["beginOffset"]; |
| 991 } |
| 992 if (_json.containsKey("content")) { |
| 993 content = _json["content"]; |
| 994 } |
| 995 } |
| 996 |
| 997 core.Map toJson() { |
| 998 var _json = new core.Map(); |
| 999 if (beginOffset != null) { |
| 1000 _json["beginOffset"] = beginOffset; |
| 1001 } |
| 1002 if (content != null) { |
| 1003 _json["content"] = content; |
| 1004 } |
| 1005 return _json; |
| 1006 } |
| 1007 } |
| 1008 |
| 1009 /** Represents the smallest syntactic building block of the text. */ |
| 1010 class Token { |
| 1011 /** Dependency tree parse for this token. */ |
| 1012 DependencyEdge dependencyEdge; |
| 1013 /** |
| 1014 * [Lemma](https://en.wikipedia.org/wiki/Lemma_(morphology)) |
| 1015 * of the token. |
| 1016 */ |
| 1017 core.String lemma; |
| 1018 /** Parts of speech tag for this token. */ |
| 1019 PartOfSpeech partOfSpeech; |
| 1020 /** The token text. */ |
| 1021 TextSpan text; |
| 1022 |
| 1023 Token(); |
| 1024 |
| 1025 Token.fromJson(core.Map _json) { |
| 1026 if (_json.containsKey("dependencyEdge")) { |
| 1027 dependencyEdge = new DependencyEdge.fromJson(_json["dependencyEdge"]); |
| 1028 } |
| 1029 if (_json.containsKey("lemma")) { |
| 1030 lemma = _json["lemma"]; |
| 1031 } |
| 1032 if (_json.containsKey("partOfSpeech")) { |
| 1033 partOfSpeech = new PartOfSpeech.fromJson(_json["partOfSpeech"]); |
| 1034 } |
| 1035 if (_json.containsKey("text")) { |
| 1036 text = new TextSpan.fromJson(_json["text"]); |
| 1037 } |
| 1038 } |
| 1039 |
| 1040 core.Map toJson() { |
| 1041 var _json = new core.Map(); |
| 1042 if (dependencyEdge != null) { |
| 1043 _json["dependencyEdge"] = (dependencyEdge).toJson(); |
| 1044 } |
| 1045 if (lemma != null) { |
| 1046 _json["lemma"] = lemma; |
| 1047 } |
| 1048 if (partOfSpeech != null) { |
| 1049 _json["partOfSpeech"] = (partOfSpeech).toJson(); |
| 1050 } |
| 1051 if (text != null) { |
| 1052 _json["text"] = (text).toJson(); |
| 1053 } |
| 1054 return _json; |
| 1055 } |
| 1056 } |
| OLD | NEW |