| Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 1 | <html><body> | 
|  | 2 | <style> | 
|  | 3 |  | 
|  | 4 | body, h1, h2, h3, div, span, p, pre, a { | 
|  | 5 | margin: 0; | 
|  | 6 | padding: 0; | 
|  | 7 | border: 0; | 
|  | 8 | font-weight: inherit; | 
|  | 9 | font-style: inherit; | 
|  | 10 | font-size: 100%; | 
|  | 11 | font-family: inherit; | 
|  | 12 | vertical-align: baseline; | 
|  | 13 | } | 
|  | 14 |  | 
|  | 15 | body { | 
|  | 16 | font-size: 13px; | 
|  | 17 | padding: 1em; | 
|  | 18 | } | 
|  | 19 |  | 
|  | 20 | h1 { | 
|  | 21 | font-size: 26px; | 
|  | 22 | margin-bottom: 1em; | 
|  | 23 | } | 
|  | 24 |  | 
|  | 25 | h2 { | 
|  | 26 | font-size: 24px; | 
|  | 27 | margin-bottom: 1em; | 
|  | 28 | } | 
|  | 29 |  | 
|  | 30 | h3 { | 
|  | 31 | font-size: 20px; | 
|  | 32 | margin-bottom: 1em; | 
|  | 33 | margin-top: 1em; | 
|  | 34 | } | 
|  | 35 |  | 
|  | 36 | pre, code { | 
|  | 37 | line-height: 1.5; | 
|  | 38 | font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; | 
|  | 39 | } | 
|  | 40 |  | 
|  | 41 | pre { | 
|  | 42 | margin-top: 0.5em; | 
|  | 43 | } | 
|  | 44 |  | 
|  | 45 | h1, h2, h3, p { | 
|  | 46 | font-family: Arial, sans serif; | 
|  | 47 | } | 
|  | 48 |  | 
|  | 49 | h1, h2, h3 { | 
|  | 50 | border-bottom: solid #CCC 1px; | 
|  | 51 | } | 
|  | 52 |  | 
|  | 53 | .toc_element { | 
|  | 54 | margin-top: 0.5em; | 
|  | 55 | } | 
|  | 56 |  | 
|  | 57 | .firstline { | 
|  | 58 | margin-left: 2 em; | 
|  | 59 | } | 
|  | 60 |  | 
|  | 61 | .method  { | 
|  | 62 | margin-top: 1em; | 
|  | 63 | border: solid 1px #CCC; | 
|  | 64 | padding: 1em; | 
|  | 65 | background: #EEE; | 
|  | 66 | } | 
|  | 67 |  | 
|  | 68 | .details { | 
|  | 69 | font-weight: bold; | 
|  | 70 | font-size: 14px; | 
|  | 71 | } | 
|  | 72 |  | 
|  | 73 | </style> | 
|  | 74 |  | 
|  | 75 | <h1><a href="documentai_v1beta2.html">Cloud Document AI API</a> . <a href="documentai_v1beta2.projects.html">projects</a> . <a href="documentai_v1beta2.projects.documents.html">documents</a></h1> | 
|  | 76 | <h2>Instance Methods</h2> | 
|  | 77 | <p class="toc_element"> | 
|  | 78 | <code><a href="#batchProcess">batchProcess(parent, body=None, x__xgafv=None)</a></code></p> | 
|  | 79 | <p class="firstline">LRO endpoint to batch process many documents. The output is written</p> | 
|  | 80 | <p class="toc_element"> | 
|  | 81 | <code><a href="#process">process(parent, body=None, x__xgafv=None)</a></code></p> | 
|  | 82 | <p class="firstline">Processes a single document.</p> | 
|  | 83 | <h3>Method Details</h3> | 
|  | 84 | <div class="method"> | 
|  | 85 | <code class="details" id="batchProcess">batchProcess(parent, body=None, x__xgafv=None)</code> | 
|  | 86 | <pre>LRO endpoint to batch process many documents. The output is written | 
|  | 87 | to Cloud Storage as JSON in the [Document] format. | 
|  | 88 |  | 
|  | 89 | Args: | 
|  | 90 | parent: string, Target project and location to make a call. | 
|  | 91 |  | 
|  | 92 | Format: `projects/{project-id}/locations/{location-id}`. | 
|  | 93 |  | 
|  | 94 | If no location is specified, a region will be chosen automatically. (required) | 
|  | 95 | body: object, The request body. | 
|  | 96 | The object takes the form of: | 
|  | 97 |  | 
|  | 98 | { # Request to batch process documents as an asynchronous operation. The output | 
|  | 99 | # is written to Cloud Storage as JSON in the [Document] format. | 
|  | 100 | "requests": [ # Required. Individual requests for each document. | 
|  | 101 | { # Request to process one document. | 
|  | 102 | "ocrParams": { # Parameters to control Optical Character Recognition (OCR) behavior. # Controls OCR behavior. If not specified, the system will decide reasonable | 
|  | 103 | # defaults. | 
|  | 104 | "languageHints": [ # List of languages to use for OCR. In most cases, an empty value | 
|  | 105 | # yields the best results since it enables automatic language detection. For | 
|  | 106 | # languages based on the Latin alphabet, setting `language_hints` is not | 
|  | 107 | # needed. In rare cases, when the language of the text in the image is known, | 
|  | 108 | # setting a hint will help get better results (although it will be a | 
|  | 109 | # significant hindrance if the hint is wrong). Document processing returns an | 
|  | 110 | # error if one or more of the specified languages is not one of the | 
|  | 111 | # supported languages. | 
|  | 112 | "A String", | 
|  | 113 | ], | 
|  | 114 | }, | 
|  | 115 | "tableExtractionParams": { # Parameters to control table extraction behavior. # Controls table extraction behavior. If not specified, the system will | 
|  | 116 | # decide reasonable defaults. | 
|  | 117 | "tableBoundHints": [ # Optional. Table bounding box hints that can be provided to complex cases | 
|  | 118 | # which our algorithm cannot locate the table(s) in. | 
|  | 119 | { # A hint for a table bounding box on the page for table parsing. | 
|  | 120 | "pageNumber": 42, # Optional. Page number for multi-paged inputs this hint applies to. If not | 
|  | 121 | # provided, this hint will apply to all pages by default. This value is | 
|  | 122 | # 1-based. | 
|  | 123 | "boundingBox": { # A bounding polygon for the detected image annotation. # Bounding box hint for a table on this page. The coordinates must be | 
|  | 124 | # normalized to [0,1] and the bounding box must be an axis-aligned rectangle. | 
|  | 125 | "normalizedVertices": [ # The bounding polygon normalized vertices. | 
|  | 126 | { # A vertex represents a 2D point in the image. | 
|  | 127 | # NOTE: the normalized vertex coordinates are relative to the original image | 
|  | 128 | # and range from 0 to 1. | 
|  | 129 | "x": 3.14, # X coordinate. | 
|  | 130 | "y": 3.14, # Y coordinate. | 
|  | 131 | }, | 
|  | 132 | ], | 
|  | 133 | "vertices": [ # The bounding polygon vertices. | 
|  | 134 | { # A vertex represents a 2D point in the image. | 
|  | 135 | # NOTE: the vertex coordinates are in the same scale as the original image. | 
|  | 136 | "x": 42, # X coordinate. | 
|  | 137 | "y": 42, # Y coordinate. | 
|  | 138 | }, | 
|  | 139 | ], | 
|  | 140 | }, | 
|  | 141 | }, | 
|  | 142 | ], | 
|  | 143 | "headerHints": [ # Optional. Reserved for future use. | 
|  | 144 | "A String", | 
|  | 145 | ], | 
|  | 146 | "modelVersion": "A String", # Model version of the table extraction system. Default is "builtin/stable". | 
|  | 147 | # Specify "builtin/latest" for the latest model. | 
|  | 148 | "enabled": True or False, # Whether to enable table extraction. | 
|  | 149 | }, | 
|  | 150 | "automlParams": { # Parameters to control AutoML model prediction behavior. # Controls AutoML model prediction behavior. AutoMlParams cannot be used | 
|  | 151 | # together with other Params. | 
|  | 152 | "model": "A String", # Resource name of the AutoML model. | 
|  | 153 | # | 
|  | 154 | # Format: `projects/{project-id}/locations/{location-id}/models/{model-id}`. | 
|  | 155 | }, | 
|  | 156 | "inputConfig": { # The desired input location and metadata. # Required. Information about the input file. | 
|  | 157 | "gcsSource": { # The Google Cloud Storage location where the input file will be read from. # The Google Cloud Storage location to read the input from. This must be a | 
|  | 158 | # single file. | 
|  | 159 | "uri": "A String", | 
|  | 160 | }, | 
|  | 161 | "contents": "A String", # Content in bytes, represented as a stream of bytes. | 
|  | 162 | # Note: As with all `bytes` fields, proto buffer messages use a pure binary | 
|  | 163 | # representation, whereas JSON representations use base64. | 
|  | 164 | # | 
|  | 165 | # This field only works for synchronous ProcessDocument method. | 
|  | 166 | "mimeType": "A String", # Required. Mimetype of the input. Current supported mimetypes are application/pdf, | 
|  | 167 | # image/tiff, and image/gif. | 
|  | 168 | # In addition, application/json type is supported for requests with | 
|  | 169 | # ProcessDocumentRequest.automl_params field set. The JSON file needs to | 
|  | 170 | # be in Document format. | 
|  | 171 | }, | 
|  | 172 | "formExtractionParams": { # Parameters to control form extraction behavior. # Controls form extraction behavior. If not specified, the system will | 
|  | 173 | # decide reasonable defaults. | 
|  | 174 | "modelVersion": "A String", # Model version of the form extraction system. Default is | 
|  | 175 | # "builtin/stable". Specify "builtin/latest" for the latest model. | 
|  | 176 | # For custom form models, specify: “custom/{model_name}". Model name | 
|  | 177 | # format is "bucket_name/path/to/modeldir" corresponding to | 
|  | 178 | # "gs://bucket_name/path/to/modeldir" where annotated examples are stored. | 
|  | 179 | "enabled": True or False, # Whether to enable form extraction. | 
|  | 180 | "keyValuePairHints": [ # Reserved for future use. | 
|  | 181 | { # Reserved for future use. | 
|  | 182 | "valueTypes": [ # Type of the value. This is case-insensitive, and could be one of: | 
|  | 183 | # ADDRESS, LOCATION, ORGANIZATION, PERSON, PHONE_NUMBER, | 
|  | 184 | # ID, NUMBER, EMAIL, PRICE, TERMS, DATE, NAME. Types not in this list will | 
|  | 185 | # be ignored. | 
|  | 186 | "A String", | 
|  | 187 | ], | 
|  | 188 | "key": "A String", # The key text for the hint. | 
|  | 189 | }, | 
|  | 190 | ], | 
|  | 191 | }, | 
|  | 192 | "documentType": "A String", # Specifies a known document type for deeper structure detection. Valid | 
|  | 193 | # values are currently "general" and "invoice". If not provided, "general"\ | 
|  | 194 | # is used as default. If any other value is given, the request is rejected. | 
|  | 195 | "parent": "A String", # Target project and location to make a call. | 
|  | 196 | # | 
|  | 197 | # Format: `projects/{project-id}/locations/{location-id}`. | 
|  | 198 | # | 
|  | 199 | # If no location is specified, a region will be chosen automatically. | 
|  | 200 | # This field is only populated when used in ProcessDocument method. | 
|  | 201 | "outputConfig": { # The desired output location and metadata. # The desired output location. This field is only needed in | 
|  | 202 | # BatchProcessDocumentsRequest. | 
|  | 203 | "pagesPerShard": 42, # The max number of pages to include into each output Document shard JSON on | 
|  | 204 | # Google Cloud Storage. | 
|  | 205 | # | 
|  | 206 | # The valid range is [1, 100]. If not specified, the default value is 20. | 
|  | 207 | # | 
|  | 208 | # For example, for one pdf file with 100 pages, 100 parsed pages will be | 
|  | 209 | # produced. If `pages_per_shard` = 20, then 5 Document shard JSON files each | 
|  | 210 | # containing 20 parsed pages will be written under the prefix | 
|  | 211 | # OutputConfig.gcs_destination.uri and suffix pages-x-to-y.json where | 
|  | 212 | # x and y are 1-indexed page numbers. | 
|  | 213 | # | 
|  | 214 | # Example GCS outputs with 157 pages and pages_per_shard = 50: | 
|  | 215 | # | 
|  | 216 | # <prefix>pages-001-to-050.json | 
|  | 217 | # <prefix>pages-051-to-100.json | 
|  | 218 | # <prefix>pages-101-to-150.json | 
|  | 219 | # <prefix>pages-151-to-157.json | 
|  | 220 | "gcsDestination": { # The Google Cloud Storage location where the output file will be written to. # The Google Cloud Storage location to write the output to. | 
|  | 221 | "uri": "A String", | 
|  | 222 | }, | 
|  | 223 | }, | 
|  | 224 | "entityExtractionParams": { # Parameters to control entity extraction behavior. # Controls entity extraction behavior. If not specified, the system will | 
|  | 225 | # decide reasonable defaults. | 
|  | 226 | "enabled": True or False, # Whether to enable entity extraction. | 
|  | 227 | "modelVersion": "A String", # Model version of the entity extraction. Default is | 
|  | 228 | # "builtin/stable". Specify "builtin/latest" for the latest model. | 
|  | 229 | }, | 
|  | 230 | }, | 
|  | 231 | ], | 
|  | 232 | } | 
|  | 233 |  | 
|  | 234 | x__xgafv: string, V1 error format. | 
|  | 235 | Allowed values | 
|  | 236 | 1 - v1 error format | 
|  | 237 | 2 - v2 error format | 
|  | 238 |  | 
|  | 239 | Returns: | 
|  | 240 | An object of the form: | 
|  | 241 |  | 
|  | 242 | { # This resource represents a long-running operation that is the result of a | 
|  | 243 | # network API call. | 
|  | 244 | "metadata": { # Service-specific metadata associated with the operation.  It typically | 
|  | 245 | # contains progress information and common metadata such as create time. | 
|  | 246 | # Some services might not provide such metadata.  Any method that returns a | 
|  | 247 | # long-running operation should document the metadata type, if any. | 
|  | 248 | "a_key": "", # Properties of the object. Contains field @type with type URL. | 
|  | 249 | }, | 
|  | 250 | "name": "A String", # The server-assigned name, which is only unique within the same service that | 
|  | 251 | # originally returns it. If you use the default HTTP mapping, the | 
|  | 252 | # `name` should be a resource name ending with `operations/{unique_id}`. | 
|  | 253 | "error": { # The `Status` type defines a logical error model that is suitable for # The error result of the operation in case of failure or cancellation. | 
|  | 254 | # different programming environments, including REST APIs and RPC APIs. It is | 
|  | 255 | # used by [gRPC](https://github.com/grpc). Each `Status` message contains | 
|  | 256 | # three pieces of data: error code, error message, and error details. | 
|  | 257 | # | 
|  | 258 | # You can find out more about this error model and how to work with it in the | 
|  | 259 | # [API Design Guide](https://cloud.google.com/apis/design/errors). | 
|  | 260 | "message": "A String", # A developer-facing error message, which should be in English. Any | 
|  | 261 | # user-facing error message should be localized and sent in the | 
|  | 262 | # google.rpc.Status.details field, or localized by the client. | 
|  | 263 | "details": [ # A list of messages that carry the error details.  There is a common set of | 
|  | 264 | # message types for APIs to use. | 
|  | 265 | { | 
|  | 266 | "a_key": "", # Properties of the object. Contains field @type with type URL. | 
|  | 267 | }, | 
|  | 268 | ], | 
|  | 269 | "code": 42, # The status code, which should be an enum value of google.rpc.Code. | 
|  | 270 | }, | 
|  | 271 | "response": { # The normal response of the operation in case of success.  If the original | 
|  | 272 | # method returns no data on success, such as `Delete`, the response is | 
|  | 273 | # `google.protobuf.Empty`.  If the original method is standard | 
|  | 274 | # `Get`/`Create`/`Update`, the response should be the resource.  For other | 
|  | 275 | # methods, the response should have the type `XxxResponse`, where `Xxx` | 
|  | 276 | # is the original method name.  For example, if the original method name | 
|  | 277 | # is `TakeSnapshot()`, the inferred response type is | 
|  | 278 | # `TakeSnapshotResponse`. | 
|  | 279 | "a_key": "", # Properties of the object. Contains field @type with type URL. | 
|  | 280 | }, | 
|  | 281 | "done": True or False, # If the value is `false`, it means the operation is still in progress. | 
|  | 282 | # If `true`, the operation is completed, and either `error` or `response` is | 
|  | 283 | # available. | 
|  | 284 | }</pre> | 
|  | 285 | </div> | 
|  | 286 |  | 
|  | 287 | <div class="method"> | 
|  | 288 | <code class="details" id="process">process(parent, body=None, x__xgafv=None)</code> | 
|  | 289 | <pre>Processes a single document. | 
|  | 290 |  | 
|  | 291 | Args: | 
|  | 292 | parent: string, Target project and location to make a call. | 
|  | 293 |  | 
|  | 294 | Format: `projects/{project-id}/locations/{location-id}`. | 
|  | 295 |  | 
|  | 296 | If no location is specified, a region will be chosen automatically. | 
|  | 297 | This field is only populated when used in ProcessDocument method. (required) | 
|  | 298 | body: object, The request body. | 
|  | 299 | The object takes the form of: | 
|  | 300 |  | 
|  | 301 | { # Request to process one document. | 
|  | 302 | "ocrParams": { # Parameters to control Optical Character Recognition (OCR) behavior. # Controls OCR behavior. If not specified, the system will decide reasonable | 
|  | 303 | # defaults. | 
|  | 304 | "languageHints": [ # List of languages to use for OCR. In most cases, an empty value | 
|  | 305 | # yields the best results since it enables automatic language detection. For | 
|  | 306 | # languages based on the Latin alphabet, setting `language_hints` is not | 
|  | 307 | # needed. In rare cases, when the language of the text in the image is known, | 
|  | 308 | # setting a hint will help get better results (although it will be a | 
|  | 309 | # significant hindrance if the hint is wrong). Document processing returns an | 
|  | 310 | # error if one or more of the specified languages is not one of the | 
|  | 311 | # supported languages. | 
|  | 312 | "A String", | 
|  | 313 | ], | 
|  | 314 | }, | 
|  | 315 | "tableExtractionParams": { # Parameters to control table extraction behavior. # Controls table extraction behavior. If not specified, the system will | 
|  | 316 | # decide reasonable defaults. | 
|  | 317 | "tableBoundHints": [ # Optional. Table bounding box hints that can be provided to complex cases | 
|  | 318 | # which our algorithm cannot locate the table(s) in. | 
|  | 319 | { # A hint for a table bounding box on the page for table parsing. | 
|  | 320 | "pageNumber": 42, # Optional. Page number for multi-paged inputs this hint applies to. If not | 
|  | 321 | # provided, this hint will apply to all pages by default. This value is | 
|  | 322 | # 1-based. | 
|  | 323 | "boundingBox": { # A bounding polygon for the detected image annotation. # Bounding box hint for a table on this page. The coordinates must be | 
|  | 324 | # normalized to [0,1] and the bounding box must be an axis-aligned rectangle. | 
|  | 325 | "normalizedVertices": [ # The bounding polygon normalized vertices. | 
|  | 326 | { # A vertex represents a 2D point in the image. | 
|  | 327 | # NOTE: the normalized vertex coordinates are relative to the original image | 
|  | 328 | # and range from 0 to 1. | 
|  | 329 | "x": 3.14, # X coordinate. | 
|  | 330 | "y": 3.14, # Y coordinate. | 
|  | 331 | }, | 
|  | 332 | ], | 
|  | 333 | "vertices": [ # The bounding polygon vertices. | 
|  | 334 | { # A vertex represents a 2D point in the image. | 
|  | 335 | # NOTE: the vertex coordinates are in the same scale as the original image. | 
|  | 336 | "x": 42, # X coordinate. | 
|  | 337 | "y": 42, # Y coordinate. | 
|  | 338 | }, | 
|  | 339 | ], | 
|  | 340 | }, | 
|  | 341 | }, | 
|  | 342 | ], | 
|  | 343 | "headerHints": [ # Optional. Reserved for future use. | 
|  | 344 | "A String", | 
|  | 345 | ], | 
|  | 346 | "modelVersion": "A String", # Model version of the table extraction system. Default is "builtin/stable". | 
|  | 347 | # Specify "builtin/latest" for the latest model. | 
|  | 348 | "enabled": True or False, # Whether to enable table extraction. | 
|  | 349 | }, | 
|  | 350 | "automlParams": { # Parameters to control AutoML model prediction behavior. # Controls AutoML model prediction behavior. AutoMlParams cannot be used | 
|  | 351 | # together with other Params. | 
|  | 352 | "model": "A String", # Resource name of the AutoML model. | 
|  | 353 | # | 
|  | 354 | # Format: `projects/{project-id}/locations/{location-id}/models/{model-id}`. | 
|  | 355 | }, | 
|  | 356 | "inputConfig": { # The desired input location and metadata. # Required. Information about the input file. | 
|  | 357 | "gcsSource": { # The Google Cloud Storage location where the input file will be read from. # The Google Cloud Storage location to read the input from. This must be a | 
|  | 358 | # single file. | 
|  | 359 | "uri": "A String", | 
|  | 360 | }, | 
|  | 361 | "contents": "A String", # Content in bytes, represented as a stream of bytes. | 
|  | 362 | # Note: As with all `bytes` fields, proto buffer messages use a pure binary | 
|  | 363 | # representation, whereas JSON representations use base64. | 
|  | 364 | # | 
|  | 365 | # This field only works for synchronous ProcessDocument method. | 
|  | 366 | "mimeType": "A String", # Required. Mimetype of the input. Current supported mimetypes are application/pdf, | 
|  | 367 | # image/tiff, and image/gif. | 
|  | 368 | # In addition, application/json type is supported for requests with | 
|  | 369 | # ProcessDocumentRequest.automl_params field set. The JSON file needs to | 
|  | 370 | # be in Document format. | 
|  | 371 | }, | 
|  | 372 | "formExtractionParams": { # Parameters to control form extraction behavior. # Controls form extraction behavior. If not specified, the system will | 
|  | 373 | # decide reasonable defaults. | 
|  | 374 | "modelVersion": "A String", # Model version of the form extraction system. Default is | 
|  | 375 | # "builtin/stable". Specify "builtin/latest" for the latest model. | 
|  | 376 | # For custom form models, specify: “custom/{model_name}". Model name | 
|  | 377 | # format is "bucket_name/path/to/modeldir" corresponding to | 
|  | 378 | # "gs://bucket_name/path/to/modeldir" where annotated examples are stored. | 
|  | 379 | "enabled": True or False, # Whether to enable form extraction. | 
|  | 380 | "keyValuePairHints": [ # Reserved for future use. | 
|  | 381 | { # Reserved for future use. | 
|  | 382 | "valueTypes": [ # Type of the value. This is case-insensitive, and could be one of: | 
|  | 383 | # ADDRESS, LOCATION, ORGANIZATION, PERSON, PHONE_NUMBER, | 
|  | 384 | # ID, NUMBER, EMAIL, PRICE, TERMS, DATE, NAME. Types not in this list will | 
|  | 385 | # be ignored. | 
|  | 386 | "A String", | 
|  | 387 | ], | 
|  | 388 | "key": "A String", # The key text for the hint. | 
|  | 389 | }, | 
|  | 390 | ], | 
|  | 391 | }, | 
|  | 392 | "documentType": "A String", # Specifies a known document type for deeper structure detection. Valid | 
|  | 393 | # values are currently "general" and "invoice". If not provided, "general"\ | 
|  | 394 | # is used as default. If any other value is given, the request is rejected. | 
|  | 395 | "parent": "A String", # Target project and location to make a call. | 
|  | 396 | # | 
|  | 397 | # Format: `projects/{project-id}/locations/{location-id}`. | 
|  | 398 | # | 
|  | 399 | # If no location is specified, a region will be chosen automatically. | 
|  | 400 | # This field is only populated when used in ProcessDocument method. | 
|  | 401 | "outputConfig": { # The desired output location and metadata. # The desired output location. This field is only needed in | 
|  | 402 | # BatchProcessDocumentsRequest. | 
|  | 403 | "pagesPerShard": 42, # The max number of pages to include into each output Document shard JSON on | 
|  | 404 | # Google Cloud Storage. | 
|  | 405 | # | 
|  | 406 | # The valid range is [1, 100]. If not specified, the default value is 20. | 
|  | 407 | # | 
|  | 408 | # For example, for one pdf file with 100 pages, 100 parsed pages will be | 
|  | 409 | # produced. If `pages_per_shard` = 20, then 5 Document shard JSON files each | 
|  | 410 | # containing 20 parsed pages will be written under the prefix | 
|  | 411 | # OutputConfig.gcs_destination.uri and suffix pages-x-to-y.json where | 
|  | 412 | # x and y are 1-indexed page numbers. | 
|  | 413 | # | 
|  | 414 | # Example GCS outputs with 157 pages and pages_per_shard = 50: | 
|  | 415 | # | 
|  | 416 | # <prefix>pages-001-to-050.json | 
|  | 417 | # <prefix>pages-051-to-100.json | 
|  | 418 | # <prefix>pages-101-to-150.json | 
|  | 419 | # <prefix>pages-151-to-157.json | 
|  | 420 | "gcsDestination": { # The Google Cloud Storage location where the output file will be written to. # The Google Cloud Storage location to write the output to. | 
|  | 421 | "uri": "A String", | 
|  | 422 | }, | 
|  | 423 | }, | 
|  | 424 | "entityExtractionParams": { # Parameters to control entity extraction behavior. # Controls entity extraction behavior. If not specified, the system will | 
|  | 425 | # decide reasonable defaults. | 
|  | 426 | "enabled": True or False, # Whether to enable entity extraction. | 
|  | 427 | "modelVersion": "A String", # Model version of the entity extraction. Default is | 
|  | 428 | # "builtin/stable". Specify "builtin/latest" for the latest model. | 
|  | 429 | }, | 
|  | 430 | } | 
|  | 431 |  | 
|  | 432 | x__xgafv: string, V1 error format. | 
|  | 433 | Allowed values | 
|  | 434 | 1 - v1 error format | 
|  | 435 | 2 - v2 error format | 
|  | 436 |  | 
|  | 437 | Returns: | 
|  | 438 | An object of the form: | 
|  | 439 |  | 
|  | 440 | { # Document represents the canonical document resource in Document Understanding | 
|  | 441 | # AI. | 
|  | 442 | # It is an interchange format that provides insights into documents and allows | 
|  | 443 | # for collaboration between users and Document Understanding AI to iterate and | 
|  | 444 | # optimize for quality. | 
|  | 445 | "content": "A String", # Inline document content, represented as a stream of bytes. | 
|  | 446 | # Note: As with all `bytes` fields, protobuffers use a pure binary | 
|  | 447 | # representation, whereas JSON representations use base64. | 
|  | 448 | "labels": [ # Labels for this document. | 
|  | 449 | { # Label attaches schema information and/or other metadata to segments within | 
|  | 450 | # a Document. Multiple Labels on a single field can denote either | 
|  | 451 | # different labels, different instances of the same label created at | 
|  | 452 | # different times, or some combination of both. | 
|  | 453 | "automlModel": "A String", # Label is generated AutoML model. This field stores the full resource | 
|  | 454 | # name of the AutoML model. | 
|  | 455 | # | 
|  | 456 | # Format: | 
|  | 457 | # `projects/{project-id}/locations/{location-id}/models/{model-id}` | 
|  | 458 | "confidence": 3.14, # Confidence score between 0 and 1 for label assignment. | 
|  | 459 | "name": "A String", # Name of the label. | 
|  | 460 | # | 
|  | 461 | # When the label is generated from AutoML Text Classification model, this | 
|  | 462 | # field represents the name of the category. | 
|  | 463 | }, | 
|  | 464 | ], | 
|  | 465 | "uri": "A String", # Currently supports Google Cloud Storage URI of the form | 
|  | 466 | #    `gs://bucket_name/object_name`. Object versioning is not supported. | 
|  | 467 | #    See [Google Cloud Storage Request | 
|  | 468 | #    URIs](https://cloud.google.com/storage/docs/reference-uris) for more | 
|  | 469 | #    info. | 
|  | 470 | "error": { # The `Status` type defines a logical error model that is suitable for # Any error that occurred while processing this document. | 
|  | 471 | # different programming environments, including REST APIs and RPC APIs. It is | 
|  | 472 | # used by [gRPC](https://github.com/grpc). Each `Status` message contains | 
|  | 473 | # three pieces of data: error code, error message, and error details. | 
|  | 474 | # | 
|  | 475 | # You can find out more about this error model and how to work with it in the | 
|  | 476 | # [API Design Guide](https://cloud.google.com/apis/design/errors). | 
|  | 477 | "message": "A String", # A developer-facing error message, which should be in English. Any | 
|  | 478 | # user-facing error message should be localized and sent in the | 
|  | 479 | # google.rpc.Status.details field, or localized by the client. | 
|  | 480 | "details": [ # A list of messages that carry the error details.  There is a common set of | 
|  | 481 | # message types for APIs to use. | 
|  | 482 | { | 
|  | 483 | "a_key": "", # Properties of the object. Contains field @type with type URL. | 
|  | 484 | }, | 
|  | 485 | ], | 
|  | 486 | "code": 42, # The status code, which should be an enum value of google.rpc.Code. | 
|  | 487 | }, | 
|  | 488 | "pages": [ # Visual page layout for the Document. | 
|  | 489 | { # A page in a Document. | 
|  | 490 | "dimension": { # Dimension for the page. # Physical dimension of the page. | 
|  | 491 | "width": 3.14, # Page width. | 
|  | 492 | "height": 3.14, # Page height. | 
|  | 493 | "unit": "A String", # Dimension unit. | 
|  | 494 | }, | 
|  | 495 | "detectedLanguages": [ # A list of detected languages together with confidence. | 
|  | 496 | { # Detected language for a structural component. | 
|  | 497 | "languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more | 
|  | 498 | # information, see | 
|  | 499 | # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. | 
|  | 500 | "confidence": 3.14, # Confidence of detected language. Range [0, 1]. | 
|  | 501 | }, | 
|  | 502 | ], | 
|  | 503 | "tables": [ # A list of visually detected tables on the page. | 
|  | 504 | { # A table representation similar to HTML table structure. | 
|  | 505 | "layout": { # Visual element describing a layout unit on a page. # Layout for Table. | 
|  | 506 | "orientation": "A String", # Detected orientation for the Layout. | 
|  | 507 | "boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon for the Layout. | 
|  | 508 | "normalizedVertices": [ # The bounding polygon normalized vertices. | 
|  | 509 | { # A vertex represents a 2D point in the image. | 
|  | 510 | # NOTE: the normalized vertex coordinates are relative to the original image | 
|  | 511 | # and range from 0 to 1. | 
|  | 512 | "x": 3.14, # X coordinate. | 
|  | 513 | "y": 3.14, # Y coordinate. | 
|  | 514 | }, | 
|  | 515 | ], | 
|  | 516 | "vertices": [ # The bounding polygon vertices. | 
|  | 517 | { # A vertex represents a 2D point in the image. | 
|  | 518 | # NOTE: the vertex coordinates are in the same scale as the original image. | 
|  | 519 | "x": 42, # X coordinate. | 
|  | 520 | "y": 42, # Y coordinate. | 
|  | 521 | }, | 
|  | 522 | ], | 
|  | 523 | }, | 
|  | 524 | "confidence": 3.14, # Confidence of the current Layout within context of the object this | 
|  | 525 | # layout is for. e.g. confidence can be for a single token, a table, | 
|  | 526 | # a visual element, etc. depending on context. Range [0, 1]. | 
|  | 527 | "textAnchor": { # Text reference indexing into the Document.text. # Text anchor indexing into the Document.text. | 
|  | 528 | "textSegments": [ # The text segments from the Document.text. | 
|  | 529 | { # A text segment in the Document.text. The indices may be out of bounds | 
|  | 530 | # which indicate that the text extends into another document shard for | 
|  | 531 | # large sharded documents. See ShardInfo.text_offset | 
|  | 532 | "startIndex": "A String", # TextSegment start UTF-8 char index in the Document.text. | 
|  | 533 | "endIndex": "A String", # TextSegment half open end UTF-8 char index in the | 
|  | 534 | # Document.text. | 
|  | 535 | }, | 
|  | 536 | ], | 
|  | 537 | }, | 
|  | 538 | }, | 
|  | 539 | "detectedLanguages": [ # A list of detected languages together with confidence. | 
|  | 540 | { # Detected language for a structural component. | 
|  | 541 | "languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more | 
|  | 542 | # information, see | 
|  | 543 | # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. | 
|  | 544 | "confidence": 3.14, # Confidence of detected language. Range [0, 1]. | 
|  | 545 | }, | 
|  | 546 | ], | 
|  | 547 | "bodyRows": [ # Body rows of the table. | 
|  | 548 | { # A row of table cells. | 
|  | 549 | "cells": [ # Cells that make up this row. | 
|  | 550 | { # A cell representation inside the table. | 
|  | 551 | "detectedLanguages": [ # A list of detected languages together with confidence. | 
|  | 552 | { # Detected language for a structural component. | 
|  | 553 | "languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more | 
|  | 554 | # information, see | 
|  | 555 | # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. | 
|  | 556 | "confidence": 3.14, # Confidence of detected language. Range [0, 1]. | 
|  | 557 | }, | 
|  | 558 | ], | 
|  | 559 | "rowSpan": 42, # How many rows this cell spans. | 
|  | 560 | "layout": { # Visual element describing a layout unit on a page. # Layout for TableCell. | 
|  | 561 | "orientation": "A String", # Detected orientation for the Layout. | 
|  | 562 | "boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon for the Layout. | 
|  | 563 | "normalizedVertices": [ # The bounding polygon normalized vertices. | 
|  | 564 | { # A vertex represents a 2D point in the image. | 
|  | 565 | # NOTE: the normalized vertex coordinates are relative to the original image | 
|  | 566 | # and range from 0 to 1. | 
|  | 567 | "x": 3.14, # X coordinate. | 
|  | 568 | "y": 3.14, # Y coordinate. | 
|  | 569 | }, | 
|  | 570 | ], | 
|  | 571 | "vertices": [ # The bounding polygon vertices. | 
|  | 572 | { # A vertex represents a 2D point in the image. | 
|  | 573 | # NOTE: the vertex coordinates are in the same scale as the original image. | 
|  | 574 | "x": 42, # X coordinate. | 
|  | 575 | "y": 42, # Y coordinate. | 
|  | 576 | }, | 
|  | 577 | ], | 
|  | 578 | }, | 
|  | 579 | "confidence": 3.14, # Confidence of the current Layout within context of the object this | 
|  | 580 | # layout is for. e.g. confidence can be for a single token, a table, | 
|  | 581 | # a visual element, etc. depending on context. Range [0, 1]. | 
|  | 582 | "textAnchor": { # Text reference indexing into the Document.text. # Text anchor indexing into the Document.text. | 
|  | 583 | "textSegments": [ # The text segments from the Document.text. | 
|  | 584 | { # A text segment in the Document.text. The indices may be out of bounds | 
|  | 585 | # which indicate that the text extends into another document shard for | 
|  | 586 | # large sharded documents. See ShardInfo.text_offset | 
|  | 587 | "startIndex": "A String", # TextSegment start UTF-8 char index in the Document.text. | 
|  | 588 | "endIndex": "A String", # TextSegment half open end UTF-8 char index in the | 
|  | 589 | # Document.text. | 
|  | 590 | }, | 
|  | 591 | ], | 
|  | 592 | }, | 
|  | 593 | }, | 
|  | 594 | "colSpan": 42, # How many columns this cell spans. | 
|  | 595 | }, | 
|  | 596 | ], | 
|  | 597 | }, | 
|  | 598 | ], | 
|  | 599 | "headerRows": [ # Header rows of the table. | 
|  | 600 | { # A row of table cells. | 
|  | 601 | "cells": [ # Cells that make up this row. | 
|  | 602 | { # A cell representation inside the table. | 
|  | 603 | "detectedLanguages": [ # A list of detected languages together with confidence. | 
|  | 604 | { # Detected language for a structural component. | 
|  | 605 | "languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more | 
|  | 606 | # information, see | 
|  | 607 | # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. | 
|  | 608 | "confidence": 3.14, # Confidence of detected language. Range [0, 1]. | 
|  | 609 | }, | 
|  | 610 | ], | 
|  | 611 | "rowSpan": 42, # How many rows this cell spans. | 
|  | 612 | "layout": { # Visual element describing a layout unit on a page. # Layout for TableCell. | 
|  | 613 | "orientation": "A String", # Detected orientation for the Layout. | 
|  | 614 | "boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon for the Layout. | 
|  | 615 | "normalizedVertices": [ # The bounding polygon normalized vertices. | 
|  | 616 | { # A vertex represents a 2D point in the image. | 
|  | 617 | # NOTE: the normalized vertex coordinates are relative to the original image | 
|  | 618 | # and range from 0 to 1. | 
|  | 619 | "x": 3.14, # X coordinate. | 
|  | 620 | "y": 3.14, # Y coordinate. | 
|  | 621 | }, | 
|  | 622 | ], | 
|  | 623 | "vertices": [ # The bounding polygon vertices. | 
|  | 624 | { # A vertex represents a 2D point in the image. | 
|  | 625 | # NOTE: the vertex coordinates are in the same scale as the original image. | 
|  | 626 | "x": 42, # X coordinate. | 
|  | 627 | "y": 42, # Y coordinate. | 
|  | 628 | }, | 
|  | 629 | ], | 
|  | 630 | }, | 
|  | 631 | "confidence": 3.14, # Confidence of the current Layout within context of the object this | 
|  | 632 | # layout is for. e.g. confidence can be for a single token, a table, | 
|  | 633 | # a visual element, etc. depending on context. Range [0, 1]. | 
|  | 634 | "textAnchor": { # Text reference indexing into the Document.text. # Text anchor indexing into the Document.text. | 
|  | 635 | "textSegments": [ # The text segments from the Document.text. | 
|  | 636 | { # A text segment in the Document.text. The indices may be out of bounds | 
|  | 637 | # which indicate that the text extends into another document shard for | 
|  | 638 | # large sharded documents. See ShardInfo.text_offset | 
|  | 639 | "startIndex": "A String", # TextSegment start UTF-8 char index in the Document.text. | 
|  | 640 | "endIndex": "A String", # TextSegment half open end UTF-8 char index in the | 
|  | 641 | # Document.text. | 
|  | 642 | }, | 
|  | 643 | ], | 
|  | 644 | }, | 
|  | 645 | }, | 
|  | 646 | "colSpan": 42, # How many columns this cell spans. | 
|  | 647 | }, | 
|  | 648 | ], | 
|  | 649 | }, | 
|  | 650 | ], | 
|  | 651 | }, | 
|  | 652 | ], | 
|  | 653 | "layout": { # Visual element describing a layout unit on a page. # Layout for the page. | 
|  | 654 | "orientation": "A String", # Detected orientation for the Layout. | 
|  | 655 | "boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon for the Layout. | 
|  | 656 | "normalizedVertices": [ # The bounding polygon normalized vertices. | 
|  | 657 | { # A vertex represents a 2D point in the image. | 
|  | 658 | # NOTE: the normalized vertex coordinates are relative to the original image | 
|  | 659 | # and range from 0 to 1. | 
|  | 660 | "x": 3.14, # X coordinate. | 
|  | 661 | "y": 3.14, # Y coordinate. | 
|  | 662 | }, | 
|  | 663 | ], | 
|  | 664 | "vertices": [ # The bounding polygon vertices. | 
|  | 665 | { # A vertex represents a 2D point in the image. | 
|  | 666 | # NOTE: the vertex coordinates are in the same scale as the original image. | 
|  | 667 | "x": 42, # X coordinate. | 
|  | 668 | "y": 42, # Y coordinate. | 
|  | 669 | }, | 
|  | 670 | ], | 
|  | 671 | }, | 
|  | 672 | "confidence": 3.14, # Confidence of the current Layout within context of the object this | 
|  | 673 | # layout is for. e.g. confidence can be for a single token, a table, | 
|  | 674 | # a visual element, etc. depending on context. Range [0, 1]. | 
|  | 675 | "textAnchor": { # Text reference indexing into the Document.text. # Text anchor indexing into the Document.text. | 
|  | 676 | "textSegments": [ # The text segments from the Document.text. | 
|  | 677 | { # A text segment in the Document.text. The indices may be out of bounds | 
|  | 678 | # which indicate that the text extends into another document shard for | 
|  | 679 | # large sharded documents. See ShardInfo.text_offset | 
|  | 680 | "startIndex": "A String", # TextSegment start UTF-8 char index in the Document.text. | 
|  | 681 | "endIndex": "A String", # TextSegment half open end UTF-8 char index in the | 
|  | 682 | # Document.text. | 
|  | 683 | }, | 
|  | 684 | ], | 
|  | 685 | }, | 
|  | 686 | }, | 
|  | 687 | "lines": [ # A list of visually detected text lines on the page. | 
|  | 688 | # A collection of tokens that a human would perceive as a line. | 
|  | 689 | { # A collection of tokens that a human would perceive as a line. | 
|  | 690 | # Does not cross column boundaries, can be horizontal, vertical, etc. | 
|  | 691 | "layout": { # Visual element describing a layout unit on a page. # Layout for Line. | 
|  | 692 | "orientation": "A String", # Detected orientation for the Layout. | 
|  | 693 | "boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon for the Layout. | 
|  | 694 | "normalizedVertices": [ # The bounding polygon normalized vertices. | 
|  | 695 | { # A vertex represents a 2D point in the image. | 
|  | 696 | # NOTE: the normalized vertex coordinates are relative to the original image | 
|  | 697 | # and range from 0 to 1. | 
|  | 698 | "x": 3.14, # X coordinate. | 
|  | 699 | "y": 3.14, # Y coordinate. | 
|  | 700 | }, | 
|  | 701 | ], | 
|  | 702 | "vertices": [ # The bounding polygon vertices. | 
|  | 703 | { # A vertex represents a 2D point in the image. | 
|  | 704 | # NOTE: the vertex coordinates are in the same scale as the original image. | 
|  | 705 | "x": 42, # X coordinate. | 
|  | 706 | "y": 42, # Y coordinate. | 
|  | 707 | }, | 
|  | 708 | ], | 
|  | 709 | }, | 
|  | 710 | "confidence": 3.14, # Confidence of the current Layout within context of the object this | 
|  | 711 | # layout is for. e.g. confidence can be for a single token, a table, | 
|  | 712 | # a visual element, etc. depending on context. Range [0, 1]. | 
|  | 713 | "textAnchor": { # Text reference indexing into the Document.text. # Text anchor indexing into the Document.text. | 
|  | 714 | "textSegments": [ # The text segments from the Document.text. | 
|  | 715 | { # A text segment in the Document.text. The indices may be out of bounds | 
|  | 716 | # which indicate that the text extends into another document shard for | 
|  | 717 | # large sharded documents. See ShardInfo.text_offset | 
|  | 718 | "startIndex": "A String", # TextSegment start UTF-8 char index in the Document.text. | 
|  | 719 | "endIndex": "A String", # TextSegment half open end UTF-8 char index in the | 
|  | 720 | # Document.text. | 
|  | 721 | }, | 
|  | 722 | ], | 
|  | 723 | }, | 
|  | 724 | }, | 
|  | 725 | "detectedLanguages": [ # A list of detected languages together with confidence. | 
|  | 726 | { # Detected language for a structural component. | 
|  | 727 | "languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more | 
|  | 728 | # information, see | 
|  | 729 | # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. | 
|  | 730 | "confidence": 3.14, # Confidence of detected language. Range [0, 1]. | 
|  | 731 | }, | 
|  | 732 | ], | 
|  | 733 | }, | 
|  | 734 | ], | 
|  | 735 | "paragraphs": [ # A list of visually detected text paragraphs on the page. | 
|  | 736 | # A collection of lines that a human would perceive as a paragraph. | 
|  | 737 | { # A collection of lines that a human would perceive as a paragraph. | 
|  | 738 | "detectedLanguages": [ # A list of detected languages together with confidence. | 
|  | 739 | { # Detected language for a structural component. | 
|  | 740 | "languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more | 
|  | 741 | # information, see | 
|  | 742 | # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. | 
|  | 743 | "confidence": 3.14, # Confidence of detected language. Range [0, 1]. | 
|  | 744 | }, | 
|  | 745 | ], | 
|  | 746 | "layout": { # Visual element describing a layout unit on a page. # Layout for Paragraph. | 
|  | 747 | "orientation": "A String", # Detected orientation for the Layout. | 
|  | 748 | "boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon for the Layout. | 
|  | 749 | "normalizedVertices": [ # The bounding polygon normalized vertices. | 
|  | 750 | { # A vertex represents a 2D point in the image. | 
|  | 751 | # NOTE: the normalized vertex coordinates are relative to the original image | 
|  | 752 | # and range from 0 to 1. | 
|  | 753 | "x": 3.14, # X coordinate. | 
|  | 754 | "y": 3.14, # Y coordinate. | 
|  | 755 | }, | 
|  | 756 | ], | 
|  | 757 | "vertices": [ # The bounding polygon vertices. | 
|  | 758 | { # A vertex represents a 2D point in the image. | 
|  | 759 | # NOTE: the vertex coordinates are in the same scale as the original image. | 
|  | 760 | "x": 42, # X coordinate. | 
|  | 761 | "y": 42, # Y coordinate. | 
|  | 762 | }, | 
|  | 763 | ], | 
|  | 764 | }, | 
|  | 765 | "confidence": 3.14, # Confidence of the current Layout within context of the object this | 
|  | 766 | # layout is for. e.g. confidence can be for a single token, a table, | 
|  | 767 | # a visual element, etc. depending on context. Range [0, 1]. | 
|  | 768 | "textAnchor": { # Text reference indexing into the Document.text. # Text anchor indexing into the Document.text. | 
|  | 769 | "textSegments": [ # The text segments from the Document.text. | 
|  | 770 | { # A text segment in the Document.text. The indices may be out of bounds | 
|  | 771 | # which indicate that the text extends into another document shard for | 
|  | 772 | # large sharded documents. See ShardInfo.text_offset | 
|  | 773 | "startIndex": "A String", # TextSegment start UTF-8 char index in the Document.text. | 
|  | 774 | "endIndex": "A String", # TextSegment half open end UTF-8 char index in the | 
|  | 775 | # Document.text. | 
|  | 776 | }, | 
|  | 777 | ], | 
|  | 778 | }, | 
|  | 779 | }, | 
|  | 780 | }, | 
|  | 781 | ], | 
|  | 782 | "formFields": [ # A list of visually detected form fields on the page. | 
|  | 783 | { # A form field detected on the page. | 
|  | 784 | "valueType": "A String", # If the value is non-textual, this field represents the type. Current | 
|  | 785 | # valid values are: | 
|  | 786 | # - blank (this indicates the field_value is normal text) | 
|  | 787 | # - "unfilled_checkbox" | 
|  | 788 | # - "filled_checkbox" | 
|  | 789 | "fieldName": { # Visual element describing a layout unit on a page. # Layout for the FormField name. e.g. `Address`, `Email`, | 
|  | 790 | # `Grand total`, `Phone number`, etc. | 
|  | 791 | "orientation": "A String", # Detected orientation for the Layout. | 
|  | 792 | "boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon for the Layout. | 
|  | 793 | "normalizedVertices": [ # The bounding polygon normalized vertices. | 
|  | 794 | { # A vertex represents a 2D point in the image. | 
|  | 795 | # NOTE: the normalized vertex coordinates are relative to the original image | 
|  | 796 | # and range from 0 to 1. | 
|  | 797 | "x": 3.14, # X coordinate. | 
|  | 798 | "y": 3.14, # Y coordinate. | 
|  | 799 | }, | 
|  | 800 | ], | 
|  | 801 | "vertices": [ # The bounding polygon vertices. | 
|  | 802 | { # A vertex represents a 2D point in the image. | 
|  | 803 | # NOTE: the vertex coordinates are in the same scale as the original image. | 
|  | 804 | "x": 42, # X coordinate. | 
|  | 805 | "y": 42, # Y coordinate. | 
|  | 806 | }, | 
|  | 807 | ], | 
|  | 808 | }, | 
|  | 809 | "confidence": 3.14, # Confidence of the current Layout within context of the object this | 
|  | 810 | # layout is for. e.g. confidence can be for a single token, a table, | 
|  | 811 | # a visual element, etc. depending on context. Range [0, 1]. | 
|  | 812 | "textAnchor": { # Text reference indexing into the Document.text. # Text anchor indexing into the Document.text. | 
|  | 813 | "textSegments": [ # The text segments from the Document.text. | 
|  | 814 | { # A text segment in the Document.text. The indices may be out of bounds | 
|  | 815 | # which indicate that the text extends into another document shard for | 
|  | 816 | # large sharded documents. See ShardInfo.text_offset | 
|  | 817 | "startIndex": "A String", # TextSegment start UTF-8 char index in the Document.text. | 
|  | 818 | "endIndex": "A String", # TextSegment half open end UTF-8 char index in the | 
|  | 819 | # Document.text. | 
|  | 820 | }, | 
|  | 821 | ], | 
|  | 822 | }, | 
|  | 823 | }, | 
|  | 824 | "nameDetectedLanguages": [ # A list of detected languages for name together with confidence. | 
|  | 825 | { # Detected language for a structural component. | 
|  | 826 | "languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more | 
|  | 827 | # information, see | 
|  | 828 | # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. | 
|  | 829 | "confidence": 3.14, # Confidence of detected language. Range [0, 1]. | 
|  | 830 | }, | 
|  | 831 | ], | 
|  | 832 | "valueDetectedLanguages": [ # A list of detected languages for value together with confidence. | 
|  | 833 | { # Detected language for a structural component. | 
|  | 834 | "languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more | 
|  | 835 | # information, see | 
|  | 836 | # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. | 
|  | 837 | "confidence": 3.14, # Confidence of detected language. Range [0, 1]. | 
|  | 838 | }, | 
|  | 839 | ], | 
|  | 840 | "fieldValue": { # Visual element describing a layout unit on a page. # Layout for the FormField value. | 
|  | 841 | "orientation": "A String", # Detected orientation for the Layout. | 
|  | 842 | "boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon for the Layout. | 
|  | 843 | "normalizedVertices": [ # The bounding polygon normalized vertices. | 
|  | 844 | { # A vertex represents a 2D point in the image. | 
|  | 845 | # NOTE: the normalized vertex coordinates are relative to the original image | 
|  | 846 | # and range from 0 to 1. | 
|  | 847 | "x": 3.14, # X coordinate. | 
|  | 848 | "y": 3.14, # Y coordinate. | 
|  | 849 | }, | 
|  | 850 | ], | 
|  | 851 | "vertices": [ # The bounding polygon vertices. | 
|  | 852 | { # A vertex represents a 2D point in the image. | 
|  | 853 | # NOTE: the vertex coordinates are in the same scale as the original image. | 
|  | 854 | "x": 42, # X coordinate. | 
|  | 855 | "y": 42, # Y coordinate. | 
|  | 856 | }, | 
|  | 857 | ], | 
|  | 858 | }, | 
|  | 859 | "confidence": 3.14, # Confidence of the current Layout within context of the object this | 
|  | 860 | # layout is for. e.g. confidence can be for a single token, a table, | 
|  | 861 | # a visual element, etc. depending on context. Range [0, 1]. | 
|  | 862 | "textAnchor": { # Text reference indexing into the Document.text. # Text anchor indexing into the Document.text. | 
|  | 863 | "textSegments": [ # The text segments from the Document.text. | 
|  | 864 | { # A text segment in the Document.text. The indices may be out of bounds | 
|  | 865 | # which indicate that the text extends into another document shard for | 
|  | 866 | # large sharded documents. See ShardInfo.text_offset | 
|  | 867 | "startIndex": "A String", # TextSegment start UTF-8 char index in the Document.text. | 
|  | 868 | "endIndex": "A String", # TextSegment half open end UTF-8 char index in the | 
|  | 869 | # Document.text. | 
|  | 870 | }, | 
|  | 871 | ], | 
|  | 872 | }, | 
|  | 873 | }, | 
|  | 874 | }, | 
|  | 875 | ], | 
|  | 876 | "blocks": [ # A list of visually detected text blocks on the page. | 
|  | 877 | # A block has a set of lines (collected into paragraphs) that have a common | 
|  | 878 | # line-spacing and orientation. | 
|  | 879 | { # A block has a set of lines (collected into paragraphs) that have a | 
|  | 880 | # common line-spacing and orientation. | 
|  | 881 | "layout": { # Visual element describing a layout unit on a page. # Layout for Block. | 
|  | 882 | "orientation": "A String", # Detected orientation for the Layout. | 
|  | 883 | "boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon for the Layout. | 
|  | 884 | "normalizedVertices": [ # The bounding polygon normalized vertices. | 
|  | 885 | { # A vertex represents a 2D point in the image. | 
|  | 886 | # NOTE: the normalized vertex coordinates are relative to the original image | 
|  | 887 | # and range from 0 to 1. | 
|  | 888 | "x": 3.14, # X coordinate. | 
|  | 889 | "y": 3.14, # Y coordinate. | 
|  | 890 | }, | 
|  | 891 | ], | 
|  | 892 | "vertices": [ # The bounding polygon vertices. | 
|  | 893 | { # A vertex represents a 2D point in the image. | 
|  | 894 | # NOTE: the vertex coordinates are in the same scale as the original image. | 
|  | 895 | "x": 42, # X coordinate. | 
|  | 896 | "y": 42, # Y coordinate. | 
|  | 897 | }, | 
|  | 898 | ], | 
|  | 899 | }, | 
|  | 900 | "confidence": 3.14, # Confidence of the current Layout within context of the object this | 
|  | 901 | # layout is for. e.g. confidence can be for a single token, a table, | 
|  | 902 | # a visual element, etc. depending on context. Range [0, 1]. | 
|  | 903 | "textAnchor": { # Text reference indexing into the Document.text. # Text anchor indexing into the Document.text. | 
|  | 904 | "textSegments": [ # The text segments from the Document.text. | 
|  | 905 | { # A text segment in the Document.text. The indices may be out of bounds | 
|  | 906 | # which indicate that the text extends into another document shard for | 
|  | 907 | # large sharded documents. See ShardInfo.text_offset | 
|  | 908 | "startIndex": "A String", # TextSegment start UTF-8 char index in the Document.text. | 
|  | 909 | "endIndex": "A String", # TextSegment half open end UTF-8 char index in the | 
|  | 910 | # Document.text. | 
|  | 911 | }, | 
|  | 912 | ], | 
|  | 913 | }, | 
|  | 914 | }, | 
|  | 915 | "detectedLanguages": [ # A list of detected languages together with confidence. | 
|  | 916 | { # Detected language for a structural component. | 
|  | 917 | "languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more | 
|  | 918 | # information, see | 
|  | 919 | # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. | 
|  | 920 | "confidence": 3.14, # Confidence of detected language. Range [0, 1]. | 
|  | 921 | }, | 
|  | 922 | ], | 
|  | 923 | }, | 
|  | 924 | ], | 
|  | 925 | "tokens": [ # A list of visually detected tokens on the page. | 
|  | 926 | { # A detected token. | 
|  | 927 | "detectedBreak": { # Detected break at the end of a Token. # Detected break at the end of a Token. | 
|  | 928 | "type": "A String", # Detected break type. | 
|  | 929 | }, | 
|  | 930 | "detectedLanguages": [ # A list of detected languages together with confidence. | 
|  | 931 | { # Detected language for a structural component. | 
|  | 932 | "languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more | 
|  | 933 | # information, see | 
|  | 934 | # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. | 
|  | 935 | "confidence": 3.14, # Confidence of detected language. Range [0, 1]. | 
|  | 936 | }, | 
|  | 937 | ], | 
|  | 938 | "layout": { # Visual element describing a layout unit on a page. # Layout for Token. | 
|  | 939 | "orientation": "A String", # Detected orientation for the Layout. | 
|  | 940 | "boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon for the Layout. | 
|  | 941 | "normalizedVertices": [ # The bounding polygon normalized vertices. | 
|  | 942 | { # A vertex represents a 2D point in the image. | 
|  | 943 | # NOTE: the normalized vertex coordinates are relative to the original image | 
|  | 944 | # and range from 0 to 1. | 
|  | 945 | "x": 3.14, # X coordinate. | 
|  | 946 | "y": 3.14, # Y coordinate. | 
|  | 947 | }, | 
|  | 948 | ], | 
|  | 949 | "vertices": [ # The bounding polygon vertices. | 
|  | 950 | { # A vertex represents a 2D point in the image. | 
|  | 951 | # NOTE: the vertex coordinates are in the same scale as the original image. | 
|  | 952 | "x": 42, # X coordinate. | 
|  | 953 | "y": 42, # Y coordinate. | 
|  | 954 | }, | 
|  | 955 | ], | 
|  | 956 | }, | 
|  | 957 | "confidence": 3.14, # Confidence of the current Layout within context of the object this | 
|  | 958 | # layout is for. e.g. confidence can be for a single token, a table, | 
|  | 959 | # a visual element, etc. depending on context. Range [0, 1]. | 
|  | 960 | "textAnchor": { # Text reference indexing into the Document.text. # Text anchor indexing into the Document.text. | 
|  | 961 | "textSegments": [ # The text segments from the Document.text. | 
|  | 962 | { # A text segment in the Document.text. The indices may be out of bounds | 
|  | 963 | # which indicate that the text extends into another document shard for | 
|  | 964 | # large sharded documents. See ShardInfo.text_offset | 
|  | 965 | "startIndex": "A String", # TextSegment start UTF-8 char index in the Document.text. | 
|  | 966 | "endIndex": "A String", # TextSegment half open end UTF-8 char index in the | 
|  | 967 | # Document.text. | 
|  | 968 | }, | 
|  | 969 | ], | 
|  | 970 | }, | 
|  | 971 | }, | 
|  | 972 | }, | 
|  | 973 | ], | 
|  | 974 | "pageNumber": 42, # 1-based index for current Page in a parent Document. | 
|  | 975 | # Useful when a page is taken out of a Document for individual | 
|  | 976 | # processing. | 
|  | 977 | "visualElements": [ # A list of detected non-text visual elements e.g. checkbox, | 
|  | 978 | # signature etc. on the page. | 
|  | 979 | { # Detected non-text visual elements e.g. checkbox, signature etc. on the | 
|  | 980 | # page. | 
|  | 981 | "detectedLanguages": [ # A list of detected languages together with confidence. | 
|  | 982 | { # Detected language for a structural component. | 
|  | 983 | "languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more | 
|  | 984 | # information, see | 
|  | 985 | # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. | 
|  | 986 | "confidence": 3.14, # Confidence of detected language. Range [0, 1]. | 
|  | 987 | }, | 
|  | 988 | ], | 
|  | 989 | "type": "A String", # Type of the VisualElement. | 
|  | 990 | "layout": { # Visual element describing a layout unit on a page. # Layout for VisualElement. | 
|  | 991 | "orientation": "A String", # Detected orientation for the Layout. | 
|  | 992 | "boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon for the Layout. | 
|  | 993 | "normalizedVertices": [ # The bounding polygon normalized vertices. | 
|  | 994 | { # A vertex represents a 2D point in the image. | 
|  | 995 | # NOTE: the normalized vertex coordinates are relative to the original image | 
|  | 996 | # and range from 0 to 1. | 
|  | 997 | "x": 3.14, # X coordinate. | 
|  | 998 | "y": 3.14, # Y coordinate. | 
|  | 999 | }, | 
|  | 1000 | ], | 
|  | 1001 | "vertices": [ # The bounding polygon vertices. | 
|  | 1002 | { # A vertex represents a 2D point in the image. | 
|  | 1003 | # NOTE: the vertex coordinates are in the same scale as the original image. | 
|  | 1004 | "x": 42, # X coordinate. | 
|  | 1005 | "y": 42, # Y coordinate. | 
|  | 1006 | }, | 
|  | 1007 | ], | 
|  | 1008 | }, | 
|  | 1009 | "confidence": 3.14, # Confidence of the current Layout within context of the object this | 
|  | 1010 | # layout is for. e.g. confidence can be for a single token, a table, | 
|  | 1011 | # a visual element, etc. depending on context. Range [0, 1]. | 
|  | 1012 | "textAnchor": { # Text reference indexing into the Document.text. # Text anchor indexing into the Document.text. | 
|  | 1013 | "textSegments": [ # The text segments from the Document.text. | 
|  | 1014 | { # A text segment in the Document.text. The indices may be out of bounds | 
|  | 1015 | # which indicate that the text extends into another document shard for | 
|  | 1016 | # large sharded documents. See ShardInfo.text_offset | 
|  | 1017 | "startIndex": "A String", # TextSegment start UTF-8 char index in the Document.text. | 
|  | 1018 | "endIndex": "A String", # TextSegment half open end UTF-8 char index in the | 
|  | 1019 | # Document.text. | 
|  | 1020 | }, | 
|  | 1021 | ], | 
|  | 1022 | }, | 
|  | 1023 | }, | 
|  | 1024 | }, | 
|  | 1025 | ], | 
|  | 1026 | }, | 
|  | 1027 | ], | 
|  | 1028 | "text": "A String", # UTF-8 encoded text in reading order from the document. | 
|  | 1029 | "mimeType": "A String", # An IANA published MIME type (also referred to as media type). For more | 
|  | 1030 | # information, see | 
|  | 1031 | # https://www.iana.org/assignments/media-types/media-types.xhtml. | 
|  | 1032 | "entityRelations": [ # Relationship among Document.entities. | 
|  | 1033 | { # Relationship between Entities. | 
|  | 1034 | "objectId": "A String", # Object entity id. | 
|  | 1035 | "relation": "A String", # Relationship description. | 
|  | 1036 | "subjectId": "A String", # Subject entity id. | 
|  | 1037 | }, | 
|  | 1038 | ], | 
|  | 1039 | "translations": [ # A list of translations on Document.text. For document shards, | 
|  | 1040 | # translations in this list may cross shard boundaries. | 
|  | 1041 | { # A translation of the text segment. | 
|  | 1042 | "textAnchor": { # Text reference indexing into the Document.text. # Provenance of the translation. | 
|  | 1043 | # Text anchor indexing into the Document.text. | 
|  | 1044 | "textSegments": [ # The text segments from the Document.text. | 
|  | 1045 | { # A text segment in the Document.text. The indices may be out of bounds | 
|  | 1046 | # which indicate that the text extends into another document shard for | 
|  | 1047 | # large sharded documents. See ShardInfo.text_offset | 
|  | 1048 | "startIndex": "A String", # TextSegment start UTF-8 char index in the Document.text. | 
|  | 1049 | "endIndex": "A String", # TextSegment half open end UTF-8 char index in the | 
|  | 1050 | # Document.text. | 
|  | 1051 | }, | 
|  | 1052 | ], | 
|  | 1053 | }, | 
|  | 1054 | "languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more | 
|  | 1055 | # information, see | 
|  | 1056 | # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. | 
|  | 1057 | "translatedText": "A String", # Text translated into the target language. | 
|  | 1058 | }, | 
|  | 1059 | ], | 
|  | 1060 | "shardInfo": { # For a large document, sharding may be performed to produce several # Information about the sharding if this document is sharded part of a larger | 
|  | 1061 | # document. If the document is not sharded, this message is not specified. | 
|  | 1062 | # document shards. Each document shard contains this field to detail which | 
|  | 1063 | # shard it is. | 
|  | 1064 | "shardIndex": "A String", # The 0-based index of this shard. | 
|  | 1065 | "textOffset": "A String", # The index of the first character in Document.text in the overall | 
|  | 1066 | # document global text. | 
|  | 1067 | "shardCount": "A String", # Total number of shards. | 
|  | 1068 | }, | 
|  | 1069 | "textStyles": [ # Styles for the Document.text. | 
|  | 1070 | { # Annotation for common text style attributes. This adheres to CSS | 
|  | 1071 | # conventions as much as possible. | 
|  | 1072 | "fontWeight": "A String", # Font weight. Possible values are normal, bold, bolder, and lighter. | 
|  | 1073 | # https://www.w3schools.com/cssref/pr_font_weight.asp | 
|  | 1074 | "textAnchor": { # Text reference indexing into the Document.text. # Text anchor indexing into the Document.text. | 
|  | 1075 | "textSegments": [ # The text segments from the Document.text. | 
|  | 1076 | { # A text segment in the Document.text. The indices may be out of bounds | 
|  | 1077 | # which indicate that the text extends into another document shard for | 
|  | 1078 | # large sharded documents. See ShardInfo.text_offset | 
|  | 1079 | "startIndex": "A String", # TextSegment start UTF-8 char index in the Document.text. | 
|  | 1080 | "endIndex": "A String", # TextSegment half open end UTF-8 char index in the | 
|  | 1081 | # Document.text. | 
|  | 1082 | }, | 
|  | 1083 | ], | 
|  | 1084 | }, | 
|  | 1085 | "textDecoration": "A String", # Text decoration. Follows CSS standard. | 
|  | 1086 | # <text-decoration-line> <text-decoration-color> <text-decoration-style> | 
|  | 1087 | # https://www.w3schools.com/cssref/pr_text_text-decoration.asp | 
|  | 1088 | "color": { # Represents a color in the RGBA color space. This representation is designed # Text color. | 
|  | 1089 | # for simplicity of conversion to/from color representations in various | 
|  | 1090 | # languages over compactness; for example, the fields of this representation | 
|  | 1091 | # can be trivially provided to the constructor of "java.awt.Color" in Java; it | 
|  | 1092 | # can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha" | 
|  | 1093 | # method in iOS; and, with just a little work, it can be easily formatted into | 
|  | 1094 | # a CSS "rgba()" string in JavaScript, as well. | 
|  | 1095 | # | 
|  | 1096 | # Note: this proto does not carry information about the absolute color space | 
|  | 1097 | # that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, | 
|  | 1098 | # DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color | 
|  | 1099 | # space. | 
|  | 1100 | # | 
|  | 1101 | # Note: when color equality needs to be decided, implementations, unless | 
|  | 1102 | # documented otherwise, will treat two colors to be equal if all their red, | 
|  | 1103 | # green, blue and alpha values each differ by at most 1e-5. | 
|  | 1104 | # | 
|  | 1105 | # Example (Java): | 
|  | 1106 | # | 
|  | 1107 | #      import com.google.type.Color; | 
|  | 1108 | # | 
|  | 1109 | #      // ... | 
|  | 1110 | #      public static java.awt.Color fromProto(Color protocolor) { | 
|  | 1111 | #        float alpha = protocolor.hasAlpha() | 
|  | 1112 | #            ? protocolor.getAlpha().getValue() | 
|  | 1113 | #            : 1.0; | 
|  | 1114 | # | 
|  | 1115 | #        return new java.awt.Color( | 
|  | 1116 | #            protocolor.getRed(), | 
|  | 1117 | #            protocolor.getGreen(), | 
|  | 1118 | #            protocolor.getBlue(), | 
|  | 1119 | #            alpha); | 
|  | 1120 | #      } | 
|  | 1121 | # | 
|  | 1122 | #      public static Color toProto(java.awt.Color color) { | 
|  | 1123 | #        float red = (float) color.getRed(); | 
|  | 1124 | #        float green = (float) color.getGreen(); | 
|  | 1125 | #        float blue = (float) color.getBlue(); | 
|  | 1126 | #        float denominator = 255.0; | 
|  | 1127 | #        Color.Builder resultBuilder = | 
|  | 1128 | #            Color | 
|  | 1129 | #                .newBuilder() | 
|  | 1130 | #                .setRed(red / denominator) | 
|  | 1131 | #                .setGreen(green / denominator) | 
|  | 1132 | #                .setBlue(blue / denominator); | 
|  | 1133 | #        int alpha = color.getAlpha(); | 
|  | 1134 | #        if (alpha != 255) { | 
|  | 1135 | #          result.setAlpha( | 
|  | 1136 | #              FloatValue | 
|  | 1137 | #                  .newBuilder() | 
|  | 1138 | #                  .setValue(((float) alpha) / denominator) | 
|  | 1139 | #                  .build()); | 
|  | 1140 | #        } | 
|  | 1141 | #        return resultBuilder.build(); | 
|  | 1142 | #      } | 
|  | 1143 | #      // ... | 
|  | 1144 | # | 
|  | 1145 | # Example (iOS / Obj-C): | 
|  | 1146 | # | 
|  | 1147 | #      // ... | 
|  | 1148 | #      static UIColor* fromProto(Color* protocolor) { | 
|  | 1149 | #         float red = [protocolor red]; | 
|  | 1150 | #         float green = [protocolor green]; | 
|  | 1151 | #         float blue = [protocolor blue]; | 
|  | 1152 | #         FloatValue* alpha_wrapper = [protocolor alpha]; | 
|  | 1153 | #         float alpha = 1.0; | 
|  | 1154 | #         if (alpha_wrapper != nil) { | 
|  | 1155 | #           alpha = [alpha_wrapper value]; | 
|  | 1156 | #         } | 
|  | 1157 | #         return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; | 
|  | 1158 | #      } | 
|  | 1159 | # | 
|  | 1160 | #      static Color* toProto(UIColor* color) { | 
|  | 1161 | #          CGFloat red, green, blue, alpha; | 
|  | 1162 | #          if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { | 
|  | 1163 | #            return nil; | 
|  | 1164 | #          } | 
|  | 1165 | #          Color* result = [[Color alloc] init]; | 
|  | 1166 | #          [result setRed:red]; | 
|  | 1167 | #          [result setGreen:green]; | 
|  | 1168 | #          [result setBlue:blue]; | 
|  | 1169 | #          if (alpha <= 0.9999) { | 
|  | 1170 | #            [result setAlpha:floatWrapperWithValue(alpha)]; | 
|  | 1171 | #          } | 
|  | 1172 | #          [result autorelease]; | 
|  | 1173 | #          return result; | 
|  | 1174 | #     } | 
|  | 1175 | #     // ... | 
|  | 1176 | # | 
|  | 1177 | #  Example (JavaScript): | 
|  | 1178 | # | 
|  | 1179 | #     // ... | 
|  | 1180 | # | 
|  | 1181 | #     var protoToCssColor = function(rgb_color) { | 
|  | 1182 | #        var redFrac = rgb_color.red || 0.0; | 
|  | 1183 | #        var greenFrac = rgb_color.green || 0.0; | 
|  | 1184 | #        var blueFrac = rgb_color.blue || 0.0; | 
|  | 1185 | #        var red = Math.floor(redFrac * 255); | 
|  | 1186 | #        var green = Math.floor(greenFrac * 255); | 
|  | 1187 | #        var blue = Math.floor(blueFrac * 255); | 
|  | 1188 | # | 
|  | 1189 | #        if (!('alpha' in rgb_color)) { | 
|  | 1190 | #           return rgbToCssColor_(red, green, blue); | 
|  | 1191 | #        } | 
|  | 1192 | # | 
|  | 1193 | #        var alphaFrac = rgb_color.alpha.value || 0.0; | 
|  | 1194 | #        var rgbParams = [red, green, blue].join(','); | 
|  | 1195 | #        return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); | 
|  | 1196 | #     }; | 
|  | 1197 | # | 
|  | 1198 | #     var rgbToCssColor_ = function(red, green, blue) { | 
|  | 1199 | #       var rgbNumber = new Number((red << 16) | (green << 8) | blue); | 
|  | 1200 | #       var hexString = rgbNumber.toString(16); | 
|  | 1201 | #       var missingZeros = 6 - hexString.length; | 
|  | 1202 | #       var resultBuilder = ['#']; | 
|  | 1203 | #       for (var i = 0; i < missingZeros; i++) { | 
|  | 1204 | #          resultBuilder.push('0'); | 
|  | 1205 | #       } | 
|  | 1206 | #       resultBuilder.push(hexString); | 
|  | 1207 | #       return resultBuilder.join(''); | 
|  | 1208 | #     }; | 
|  | 1209 | # | 
|  | 1210 | #     // ... | 
|  | 1211 | "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, | 
|  | 1212 | # the final pixel color is defined by the equation: | 
|  | 1213 | # | 
|  | 1214 | #   pixel color = alpha * (this color) + (1.0 - alpha) * (background color) | 
|  | 1215 | # | 
|  | 1216 | # This means that a value of 1.0 corresponds to a solid color, whereas | 
|  | 1217 | # a value of 0.0 corresponds to a completely transparent color. This | 
|  | 1218 | # uses a wrapper message rather than a simple float scalar so that it is | 
|  | 1219 | # possible to distinguish between a default value and the value being unset. | 
|  | 1220 | # If omitted, this color object is to be rendered as a solid color | 
|  | 1221 | # (as if the alpha value had been explicitly given with a value of 1.0). | 
|  | 1222 | "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. | 
|  | 1223 | "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. | 
|  | 1224 | "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. | 
|  | 1225 | }, | 
|  | 1226 | "fontSize": { # Font size with unit. # Font size. | 
|  | 1227 | "size": 3.14, # Font size for the text. | 
|  | 1228 | "unit": "A String", # Unit for the font size. Follows CSS naming (in, px, pt, etc.). | 
|  | 1229 | }, | 
|  | 1230 | "backgroundColor": { # Represents a color in the RGBA color space. This representation is designed # Text background color. | 
|  | 1231 | # for simplicity of conversion to/from color representations in various | 
|  | 1232 | # languages over compactness; for example, the fields of this representation | 
|  | 1233 | # can be trivially provided to the constructor of "java.awt.Color" in Java; it | 
|  | 1234 | # can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha" | 
|  | 1235 | # method in iOS; and, with just a little work, it can be easily formatted into | 
|  | 1236 | # a CSS "rgba()" string in JavaScript, as well. | 
|  | 1237 | # | 
|  | 1238 | # Note: this proto does not carry information about the absolute color space | 
|  | 1239 | # that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, | 
|  | 1240 | # DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color | 
|  | 1241 | # space. | 
|  | 1242 | # | 
|  | 1243 | # Note: when color equality needs to be decided, implementations, unless | 
|  | 1244 | # documented otherwise, will treat two colors to be equal if all their red, | 
|  | 1245 | # green, blue and alpha values each differ by at most 1e-5. | 
|  | 1246 | # | 
|  | 1247 | # Example (Java): | 
|  | 1248 | # | 
|  | 1249 | #      import com.google.type.Color; | 
|  | 1250 | # | 
|  | 1251 | #      // ... | 
|  | 1252 | #      public static java.awt.Color fromProto(Color protocolor) { | 
|  | 1253 | #        float alpha = protocolor.hasAlpha() | 
|  | 1254 | #            ? protocolor.getAlpha().getValue() | 
|  | 1255 | #            : 1.0; | 
|  | 1256 | # | 
|  | 1257 | #        return new java.awt.Color( | 
|  | 1258 | #            protocolor.getRed(), | 
|  | 1259 | #            protocolor.getGreen(), | 
|  | 1260 | #            protocolor.getBlue(), | 
|  | 1261 | #            alpha); | 
|  | 1262 | #      } | 
|  | 1263 | # | 
|  | 1264 | #      public static Color toProto(java.awt.Color color) { | 
|  | 1265 | #        float red = (float) color.getRed(); | 
|  | 1266 | #        float green = (float) color.getGreen(); | 
|  | 1267 | #        float blue = (float) color.getBlue(); | 
|  | 1268 | #        float denominator = 255.0; | 
|  | 1269 | #        Color.Builder resultBuilder = | 
|  | 1270 | #            Color | 
|  | 1271 | #                .newBuilder() | 
|  | 1272 | #                .setRed(red / denominator) | 
|  | 1273 | #                .setGreen(green / denominator) | 
|  | 1274 | #                .setBlue(blue / denominator); | 
|  | 1275 | #        int alpha = color.getAlpha(); | 
|  | 1276 | #        if (alpha != 255) { | 
|  | 1277 | #          result.setAlpha( | 
|  | 1278 | #              FloatValue | 
|  | 1279 | #                  .newBuilder() | 
|  | 1280 | #                  .setValue(((float) alpha) / denominator) | 
|  | 1281 | #                  .build()); | 
|  | 1282 | #        } | 
|  | 1283 | #        return resultBuilder.build(); | 
|  | 1284 | #      } | 
|  | 1285 | #      // ... | 
|  | 1286 | # | 
|  | 1287 | # Example (iOS / Obj-C): | 
|  | 1288 | # | 
|  | 1289 | #      // ... | 
|  | 1290 | #      static UIColor* fromProto(Color* protocolor) { | 
|  | 1291 | #         float red = [protocolor red]; | 
|  | 1292 | #         float green = [protocolor green]; | 
|  | 1293 | #         float blue = [protocolor blue]; | 
|  | 1294 | #         FloatValue* alpha_wrapper = [protocolor alpha]; | 
|  | 1295 | #         float alpha = 1.0; | 
|  | 1296 | #         if (alpha_wrapper != nil) { | 
|  | 1297 | #           alpha = [alpha_wrapper value]; | 
|  | 1298 | #         } | 
|  | 1299 | #         return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; | 
|  | 1300 | #      } | 
|  | 1301 | # | 
|  | 1302 | #      static Color* toProto(UIColor* color) { | 
|  | 1303 | #          CGFloat red, green, blue, alpha; | 
|  | 1304 | #          if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { | 
|  | 1305 | #            return nil; | 
|  | 1306 | #          } | 
|  | 1307 | #          Color* result = [[Color alloc] init]; | 
|  | 1308 | #          [result setRed:red]; | 
|  | 1309 | #          [result setGreen:green]; | 
|  | 1310 | #          [result setBlue:blue]; | 
|  | 1311 | #          if (alpha <= 0.9999) { | 
|  | 1312 | #            [result setAlpha:floatWrapperWithValue(alpha)]; | 
|  | 1313 | #          } | 
|  | 1314 | #          [result autorelease]; | 
|  | 1315 | #          return result; | 
|  | 1316 | #     } | 
|  | 1317 | #     // ... | 
|  | 1318 | # | 
|  | 1319 | #  Example (JavaScript): | 
|  | 1320 | # | 
|  | 1321 | #     // ... | 
|  | 1322 | # | 
|  | 1323 | #     var protoToCssColor = function(rgb_color) { | 
|  | 1324 | #        var redFrac = rgb_color.red || 0.0; | 
|  | 1325 | #        var greenFrac = rgb_color.green || 0.0; | 
|  | 1326 | #        var blueFrac = rgb_color.blue || 0.0; | 
|  | 1327 | #        var red = Math.floor(redFrac * 255); | 
|  | 1328 | #        var green = Math.floor(greenFrac * 255); | 
|  | 1329 | #        var blue = Math.floor(blueFrac * 255); | 
|  | 1330 | # | 
|  | 1331 | #        if (!('alpha' in rgb_color)) { | 
|  | 1332 | #           return rgbToCssColor_(red, green, blue); | 
|  | 1333 | #        } | 
|  | 1334 | # | 
|  | 1335 | #        var alphaFrac = rgb_color.alpha.value || 0.0; | 
|  | 1336 | #        var rgbParams = [red, green, blue].join(','); | 
|  | 1337 | #        return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); | 
|  | 1338 | #     }; | 
|  | 1339 | # | 
|  | 1340 | #     var rgbToCssColor_ = function(red, green, blue) { | 
|  | 1341 | #       var rgbNumber = new Number((red << 16) | (green << 8) | blue); | 
|  | 1342 | #       var hexString = rgbNumber.toString(16); | 
|  | 1343 | #       var missingZeros = 6 - hexString.length; | 
|  | 1344 | #       var resultBuilder = ['#']; | 
|  | 1345 | #       for (var i = 0; i < missingZeros; i++) { | 
|  | 1346 | #          resultBuilder.push('0'); | 
|  | 1347 | #       } | 
|  | 1348 | #       resultBuilder.push(hexString); | 
|  | 1349 | #       return resultBuilder.join(''); | 
|  | 1350 | #     }; | 
|  | 1351 | # | 
|  | 1352 | #     // ... | 
|  | 1353 | "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, | 
|  | 1354 | # the final pixel color is defined by the equation: | 
|  | 1355 | # | 
|  | 1356 | #   pixel color = alpha * (this color) + (1.0 - alpha) * (background color) | 
|  | 1357 | # | 
|  | 1358 | # This means that a value of 1.0 corresponds to a solid color, whereas | 
|  | 1359 | # a value of 0.0 corresponds to a completely transparent color. This | 
|  | 1360 | # uses a wrapper message rather than a simple float scalar so that it is | 
|  | 1361 | # possible to distinguish between a default value and the value being unset. | 
|  | 1362 | # If omitted, this color object is to be rendered as a solid color | 
|  | 1363 | # (as if the alpha value had been explicitly given with a value of 1.0). | 
|  | 1364 | "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. | 
|  | 1365 | "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. | 
|  | 1366 | "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. | 
|  | 1367 | }, | 
|  | 1368 | "textStyle": "A String", # Text style. Possible values are normal, italic, and oblique. | 
|  | 1369 | # https://www.w3schools.com/cssref/pr_font_font-style.asp | 
|  | 1370 | }, | 
|  | 1371 | ], | 
|  | 1372 | "entities": [ # A list of entities detected on Document.text. For document shards, | 
|  | 1373 | # entities in this list may cross shard boundaries. | 
|  | 1374 | { # A phrase in the text that is a known entity type, such as a person, an | 
|  | 1375 | # organization, or location. | 
|  | 1376 | "textAnchor": { # Text reference indexing into the Document.text. # Provenance of the entity. | 
|  | 1377 | # Text anchor indexing into the Document.text. | 
|  | 1378 | "textSegments": [ # The text segments from the Document.text. | 
|  | 1379 | { # A text segment in the Document.text. The indices may be out of bounds | 
|  | 1380 | # which indicate that the text extends into another document shard for | 
|  | 1381 | # large sharded documents. See ShardInfo.text_offset | 
|  | 1382 | "startIndex": "A String", # TextSegment start UTF-8 char index in the Document.text. | 
|  | 1383 | "endIndex": "A String", # TextSegment half open end UTF-8 char index in the | 
|  | 1384 | # Document.text. | 
|  | 1385 | }, | 
|  | 1386 | ], | 
|  | 1387 | }, | 
|  | 1388 | "mentionId": "A String", # Deprecated.  Use `id` field instead. | 
|  | 1389 | "type": "A String", # Entity type from a schema e.g. `Address`. | 
|  | 1390 | "confidence": 3.14, # Optional. Confidence of detected Schema entity. Range [0, 1]. | 
|  | 1391 | "mentionText": "A String", # Text value in the document e.g. `1600 Amphitheatre Pkwy`. | 
|  | 1392 | }, | 
|  | 1393 | ], | 
|  | 1394 | }</pre> | 
|  | 1395 | </div> | 
|  | 1396 |  | 
|  | 1397 | </body></html> |