LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.

Scopes

You will need authorization for the https://www.googleapis.com/auth/cloud-platform scope to make a valid call.

If unset, the scope for this method defaults to https://www.googleapis.com/auth/cloud-platform. You can set the scope for this method like this: documentai1 --scope <scope> projects locations-processors-processor-versions-batch-process ...

Required Scalar Argument

  • <name> (string)
    • Required. The resource name of Processor or ProcessorVersion. Format: projects/{project}/locations/{location}/processors/{processor}, or projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}

Required Request Value

The request value is a data-structure with various fields. Each field may be a simple scalar or another data-structure. In the latter case it is advised to set the field-cursor to the data-structure's field to specify values more concisely.

For example, a structure like this:

GoogleCloudDocumentaiV1BatchProcessRequest:
  document-output-config:
    gcs-output-config:
      field-mask: string
      gcs-uri: string
      sharding-config:
        pages-overlap: integer
        pages-per-shard: integer
  input-documents:
    gcs-prefix:
      gcs-uri-prefix: string
  labels: { string: string }
  process-options:
    from-end: integer
    from-start: integer
    individual-page-selector:
      pages: [integer]
    ocr-config:
      advanced-ocr-options: [string]
      compute-style-info: boolean
      disable-character-boxes-detection: boolean
      enable-image-quality-scores: boolean
      enable-native-pdf-parsing: boolean
      enable-symbol: boolean
      hints:
        language-hints: [string]
      premium-features:
        compute-style-info: boolean
        enable-math-ocr: boolean
        enable-selection-mark-detection: boolean
    schema-override:
      description: string
      display-name: string
      metadata:
        document-allow-multiple-labels: boolean
        document-splitter: boolean
        prefixed-naming-on-properties: boolean
        skip-naming-validation: boolean
  skip-human-review: boolean

can be set completely with the following arguments which are assumed to be executed in the given order. Note how the cursor position is adjusted to the respective structures, allowing simple field names to be used most of the time.

  • -r .document-output-config.gcs-output-config field-mask=no
    • Specifies which fields to include in the output documents. Only supports top level document and pages field so it must be in the form of {document_field_name} or pages.{page_field_name}.
  • gcs-uri=nonumy
    • The Cloud Storage uri (a directory) of the output.
  • sharding-config pages-overlap=24
    • The number of overlapping pages between consecutive shards.
  • pages-per-shard=56

    • The number of pages per shard.
  • ....input-documents.gcs-prefix gcs-uri-prefix=aliquyam

    • The URI prefix.
  • ... labels=key=dolores

    • Optional. The labels with user-defined metadata for the request. Label keys and values can be no longer than 63 characters (Unicode codepoints) and can only contain lowercase letters, numeric characters, underscores, and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.
    • the value will be associated with the given key
  • process-options from-end=6
    • Only process certain pages from the end, same as above.
  • from-start=70
    • Only process certain pages from the start. Process all if the document has fewer pages.
  • individual-page-selector pages=19

    • Optional. Indices of the pages (starting from 1).
    • Each invocation of this argument appends the given value to the array.
  • ..ocr-config advanced-ocr-options=amet

    • A list of advanced OCR options to further fine-tune OCR behavior. Current valid values are: - legacy_layout: a heuristics layout detection algorithm, which serves as an alternative to the current ML-based layout detection algorithm. Customers can choose the best suitable layout algorithm based on their situation.
    • Each invocation of this argument appends the given value to the array.
  • compute-style-info=true
    • Turn on font identification model and return font style information. Deprecated, use PremiumFeatures.compute_style_info instead.
  • disable-character-boxes-detection=false
    • Turn off character box detector in OCR engine. Character box detection is enabled by default in OCR 2.0 (and later) processors.
  • enable-image-quality-scores=true
    • Enables intelligent document quality scores after OCR. Can help with diagnosing why OCR responses are of poor quality for a given input. Adds additional latency comparable to regular OCR to the process call.
  • enable-native-pdf-parsing=true
    • Enables special handling for PDFs with existing text information. Results in better text extraction quality in such PDF inputs.
  • enable-symbol=false
    • Includes symbol level OCR information if set to true.
  • hints language-hints=elitr

    • List of BCP-47 language codes to use for OCR. In most cases, not specifying it yields the best results since it enables automatic language detection. For languages based on the Latin alphabet, setting hints is not needed. In rare cases, when the language of the text in the image is known, setting a hint will help get better results (although it will be a significant hindrance if the hint is wrong).
    • Each invocation of this argument appends the given value to the array.
  • ..premium-features compute-style-info=true

    • Turn on font identification model and return font style information.
  • enable-math-ocr=true
    • Turn on the model that can extract LaTeX math formulas.
  • enable-selection-mark-detection=true

    • Turn on selection mark detector in OCR engine. Only available in OCR 2.0 (and later) processors.
  • ...schema-override description=sed

    • Description of the schema.
  • display-name=eos
    • Display name to show to users.
  • metadata document-allow-multiple-labels=true
    • If true, on a given page, there can be multiple document annotations covering it.
  • document-splitter=true
    • If true, a document entity type can be applied to subdocument (splitting). Otherwise, it can only be applied to the entire document (classification).
  • prefixed-naming-on-properties=false
    • If set, all the nested entities must be prefixed with the parents.
  • skip-naming-validation=false

    • If set, we will skip the naming format validation in the schema. So the string values in DocumentSchema.EntityType.name and DocumentSchema.EntityType.Property.name will not be checked.
  • .... skip-human-review=false

    • Whether human review should be skipped for this request. Default to false.

About Cursors

The cursor position is key to comfortably set complex nested structures. The following rules apply:

  • The cursor position is always set relative to the current one, unless the field name starts with the . character. Fields can be nested such as in -r f.s.o .
  • The cursor position is set relative to the top-level structure if it starts with ., e.g. -r .s.s
  • You can also set nested fields without setting the cursor explicitly. For example, to set a value relative to the current cursor position, you would specify -r struct.sub_struct=bar.
  • You can move the cursor one level up by using ... Each additional . moves it up one additional level. E.g. ... would go three levels up.

Optional Output Flags

The method's return value a JSON encoded structure, which will be written to standard output by default.

  • -o out
    • out specifies the destination to which to write the server's result to. It will be a JSON-encoded structure. The destination may be - to indicate standard output, or a filepath that is to contain the received bytes. If unset, it defaults to standard output.

Optional General Properties

The following properties can configure any call, and are not specific to this method.

  • -p $-xgafv=string

    • V1 error format.
  • -p access-token=string

    • OAuth access token.
  • -p alt=string

    • Data format for response.
  • -p callback=string

    • JSONP
  • -p fields=string

    • Selector specifying which fields to include in a partial response.
  • -p key=string

    • API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
  • -p oauth-token=string

    • OAuth 2.0 token for the current user.
  • -p pretty-print=boolean

    • Returns response with indentations and line breaks.
  • -p quota-user=string

    • Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
  • -p upload-type=string

    • Legacy upload protocol for media (e.g. "media", "multipart").
  • -p upload-protocol=string

    • Upload protocol for media (e.g. "raw", "multipart").