Class: Google::Apis::DocumentaiV1::GoogleCloudDocumentaiV1Document

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/documentai_v1/classes.rb,
lib/google/apis/documentai_v1/representations.rb,
lib/google/apis/documentai_v1/representations.rb

Overview

Document represents the canonical document resource in Document Understanding AI. It is an interchange format that provides insights into documents and allows for collaboration between users and Document Understanding AI to iterate and optimize for quality.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ GoogleCloudDocumentaiV1Document

Returns a new instance of GoogleCloudDocumentaiV1Document.



816
817
818
# File 'lib/google/apis/documentai_v1/classes.rb', line 816

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#contentString

Optional. Inline document content, represented as a stream of bytes. Note: As with all bytes fields, protobuffers use a pure binary representation, whereas JSON representations use base64. Corresponds to the JSON property content NOTE: Values are automatically base64 encoded/decoded in the client library.

Returns:

  • (String)


745
746
747
# File 'lib/google/apis/documentai_v1/classes.rb', line 745

def content
  @content
end

#entitiesArray<Google::Apis::DocumentaiV1::GoogleCloudDocumentaiV1DocumentEntity>

A list of entities detected on Document.text. For document shards, entities in this list may cross shard boundaries. Corresponds to the JSON property entities



751
752
753
# File 'lib/google/apis/documentai_v1/classes.rb', line 751

def entities
  @entities
end

#entity_relationsArray<Google::Apis::DocumentaiV1::GoogleCloudDocumentaiV1DocumentEntityRelation>

Relationship among Document.entities. Corresponds to the JSON property entityRelations



756
757
758
# File 'lib/google/apis/documentai_v1/classes.rb', line 756

def entity_relations
  @entity_relations
end

#errorGoogle::Apis::DocumentaiV1::GoogleRpcStatus

The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC. Each Status message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the API Design Guide. Corresponds to the JSON property error



766
767
768
# File 'lib/google/apis/documentai_v1/classes.rb', line 766

def error
  @error
end

#mime_typeString

An IANA published MIME type (also referred to as media type). For more information, see https://www.iana.org/assignments/media-types/media-types. xhtml. Corresponds to the JSON property mimeType

Returns:

  • (String)


773
774
775
# File 'lib/google/apis/documentai_v1/classes.rb', line 773

def mime_type
  @mime_type
end

#pagesArray<Google::Apis::DocumentaiV1::GoogleCloudDocumentaiV1DocumentPage>

Visual page layout for the Document. Corresponds to the JSON property pages



778
779
780
# File 'lib/google/apis/documentai_v1/classes.rb', line 778

def pages
  @pages
end

#revisionsArray<Google::Apis::DocumentaiV1::GoogleCloudDocumentaiV1DocumentRevision>

Revision history of this document. Corresponds to the JSON property revisions



783
784
785
# File 'lib/google/apis/documentai_v1/classes.rb', line 783

def revisions
  @revisions
end

#shard_infoGoogle::Apis::DocumentaiV1::GoogleCloudDocumentaiV1DocumentShardInfo

For a large document, sharding may be performed to produce several document shards. Each document shard contains this field to detail which shard it is. Corresponds to the JSON property shardInfo



789
790
791
# File 'lib/google/apis/documentai_v1/classes.rb', line 789

def shard_info
  @shard_info
end

#textString

Optional. UTF-8 encoded text in reading order from the document. Corresponds to the JSON property text

Returns:

  • (String)


794
795
796
# File 'lib/google/apis/documentai_v1/classes.rb', line 794

def text
  @text
end

#text_changesArray<Google::Apis::DocumentaiV1::GoogleCloudDocumentaiV1DocumentTextChange>

A list of text corrections made to [Document.text]. This is usually used for annotating corrections to OCR mistakes. Text changes for a given revision may not overlap with each other. Corresponds to the JSON property textChanges



801
802
803
# File 'lib/google/apis/documentai_v1/classes.rb', line 801

def text_changes
  @text_changes
end

#text_stylesArray<Google::Apis::DocumentaiV1::GoogleCloudDocumentaiV1DocumentStyle>

Styles for the Document.text. Corresponds to the JSON property textStyles



806
807
808
# File 'lib/google/apis/documentai_v1/classes.rb', line 806

def text_styles
  @text_styles
end

#uriString

Optional. Currently supports Google Cloud Storage URI of the form gs:// bucket_name/object_name. Object versioning is not supported. See Google Cloud Storage Request URIs for more info. Corresponds to the JSON property uri

Returns:

  • (String)


814
815
816
# File 'lib/google/apis/documentai_v1/classes.rb', line 814

def uri
  @uri
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



821
822
823
824
825
826
827
828
829
830
831
832
833
834
# File 'lib/google/apis/documentai_v1/classes.rb', line 821

def update!(**args)
  @content = args[:content] if args.key?(:content)
  @entities = args[:entities] if args.key?(:entities)
  @entity_relations = args[:entity_relations] if args.key?(:entity_relations)
  @error = args[:error] if args.key?(:error)
  @mime_type = args[:mime_type] if args.key?(:mime_type)
  @pages = args[:pages] if args.key?(:pages)
  @revisions = args[:revisions] if args.key?(:revisions)
  @shard_info = args[:shard_info] if args.key?(:shard_info)
  @text = args[:text] if args.key?(:text)
  @text_changes = args[:text_changes] if args.key?(:text_changes)
  @text_styles = args[:text_styles] if args.key?(:text_styles)
  @uri = args[:uri] if args.key?(:uri)
end