Class: OCI::AiVision::Models::AnalyzeDocumentResult

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/ai_vision/models/analyze_document_result.rb

Overview

The document analysis results.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AnalyzeDocumentResult

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 109

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self. = attributes[:'documentMetadata'] if attributes[:'documentMetadata']

  raise 'You cannot provide both :documentMetadata and :document_metadata' if attributes.key?(:'documentMetadata') && attributes.key?(:'document_metadata')

  self. = attributes[:'document_metadata'] if attributes[:'document_metadata']

  self.pages = attributes[:'pages'] if attributes[:'pages']

  self.detected_document_types = attributes[:'detectedDocumentTypes'] if attributes[:'detectedDocumentTypes']

  raise 'You cannot provide both :detectedDocumentTypes and :detected_document_types' if attributes.key?(:'detectedDocumentTypes') && attributes.key?(:'detected_document_types')

  self.detected_document_types = attributes[:'detected_document_types'] if attributes[:'detected_document_types']

  self.detected_languages = attributes[:'detectedLanguages'] if attributes[:'detectedLanguages']

  raise 'You cannot provide both :detectedLanguages and :detected_languages' if attributes.key?(:'detectedLanguages') && attributes.key?(:'detected_languages')

  self.detected_languages = attributes[:'detected_languages'] if attributes[:'detected_languages']

  self.document_classification_model_version = attributes[:'documentClassificationModelVersion'] if attributes[:'documentClassificationModelVersion']

  raise 'You cannot provide both :documentClassificationModelVersion and :document_classification_model_version' if attributes.key?(:'documentClassificationModelVersion') && attributes.key?(:'document_classification_model_version')

  self.document_classification_model_version = attributes[:'document_classification_model_version'] if attributes[:'document_classification_model_version']

  self.language_classification_model_version = attributes[:'languageClassificationModelVersion'] if attributes[:'languageClassificationModelVersion']

  raise 'You cannot provide both :languageClassificationModelVersion and :language_classification_model_version' if attributes.key?(:'languageClassificationModelVersion') && attributes.key?(:'language_classification_model_version')

  self.language_classification_model_version = attributes[:'language_classification_model_version'] if attributes[:'language_classification_model_version']

  self.text_detection_model_version = attributes[:'textDetectionModelVersion'] if attributes[:'textDetectionModelVersion']

  raise 'You cannot provide both :textDetectionModelVersion and :text_detection_model_version' if attributes.key?(:'textDetectionModelVersion') && attributes.key?(:'text_detection_model_version')

  self.text_detection_model_version = attributes[:'text_detection_model_version'] if attributes[:'text_detection_model_version']

  self.key_value_detection_model_version = attributes[:'keyValueDetectionModelVersion'] if attributes[:'keyValueDetectionModelVersion']

  raise 'You cannot provide both :keyValueDetectionModelVersion and :key_value_detection_model_version' if attributes.key?(:'keyValueDetectionModelVersion') && attributes.key?(:'key_value_detection_model_version')

  self.key_value_detection_model_version = attributes[:'key_value_detection_model_version'] if attributes[:'key_value_detection_model_version']

  self.table_detection_model_version = attributes[:'tableDetectionModelVersion'] if attributes[:'tableDetectionModelVersion']

  raise 'You cannot provide both :tableDetectionModelVersion and :table_detection_model_version' if attributes.key?(:'tableDetectionModelVersion') && attributes.key?(:'table_detection_model_version')

  self.table_detection_model_version = attributes[:'table_detection_model_version'] if attributes[:'table_detection_model_version']

  self.errors = attributes[:'errors'] if attributes[:'errors']

  self.searchable_pdf = attributes[:'searchablePdf'] if attributes[:'searchablePdf']

  raise 'You cannot provide both :searchablePdf and :searchable_pdf' if attributes.key?(:'searchablePdf') && attributes.key?(:'searchable_pdf')

  self.searchable_pdf = attributes[:'searchable_pdf'] if attributes[:'searchable_pdf']
end

Instance Attribute Details

#detected_document_typesArray<OCI::AiVision::Models::DetectedDocumentType>

An array of detected document types.



20
21
22
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 20

def detected_document_types
  @detected_document_types
end

#detected_languagesArray<OCI::AiVision::Models::DetectedLanguage>

An array of detected languages.



24
25
26
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 24

def detected_languages
  @detected_languages
end

#document_classification_model_versionString

The document classification model version.

Returns:

  • (String)


28
29
30
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 28

def document_classification_model_version
  @document_classification_model_version
end

#document_metadataOCI::AiVision::Models::DocumentMetadata

This attribute is required.



12
13
14
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 12

def 
  @document_metadata
end

#errorsArray<OCI::AiVision::Models::ProcessingError>

The errors encountered during document analysis.



48
49
50
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 48

def errors
  @errors
end

#key_value_detection_model_versionString

The document keyValue detection model version.

Returns:

  • (String)


40
41
42
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 40

def key_value_detection_model_version
  @key_value_detection_model_version
end

#language_classification_model_versionString

The document language classification model version.

Returns:

  • (String)


32
33
34
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 32

def language_classification_model_version
  @language_classification_model_version
end

#pagesArray<OCI::AiVision::Models::Page>

**[Required]** The array of a Page.

Returns:



16
17
18
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 16

def pages
  @pages
end

#searchable_pdfString

The searchable PDF file that was generated.

Returns:

  • (String)


52
53
54
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 52

def searchable_pdf
  @searchable_pdf
end

#table_detection_model_versionString

The document table detection model version.

Returns:

  • (String)


44
45
46
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 44

def table_detection_model_version
  @table_detection_model_version
end

#text_detection_model_versionString

The document text detection model version.

Returns:

  • (String)


36
37
38
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 36

def text_detection_model_version
  @text_detection_model_version
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 55

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'document_metadata': :'documentMetadata',
    'pages': :'pages',
    'detected_document_types': :'detectedDocumentTypes',
    'detected_languages': :'detectedLanguages',
    'document_classification_model_version': :'documentClassificationModelVersion',
    'language_classification_model_version': :'languageClassificationModelVersion',
    'text_detection_model_version': :'textDetectionModelVersion',
    'key_value_detection_model_version': :'keyValueDetectionModelVersion',
    'table_detection_model_version': :'tableDetectionModelVersion',
    'errors': :'errors',
    'searchable_pdf': :'searchablePdf'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 74

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'document_metadata': :'OCI::AiVision::Models::DocumentMetadata',
    'pages': :'Array<OCI::AiVision::Models::Page>',
    'detected_document_types': :'Array<OCI::AiVision::Models::DetectedDocumentType>',
    'detected_languages': :'Array<OCI::AiVision::Models::DetectedLanguage>',
    'document_classification_model_version': :'String',
    'language_classification_model_version': :'String',
    'text_detection_model_version': :'String',
    'key_value_detection_model_version': :'String',
    'table_detection_model_version': :'String',
    'errors': :'Array<OCI::AiVision::Models::ProcessingError>',
    'searchable_pdf': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 181

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
     == other. &&
    pages == other.pages &&
    detected_document_types == other.detected_document_types &&
    detected_languages == other.detected_languages &&
    document_classification_model_version == other.document_classification_model_version &&
    language_classification_model_version == other.language_classification_model_version &&
    text_detection_model_version == other.text_detection_model_version &&
    key_value_detection_model_version == other.key_value_detection_model_version &&
    table_detection_model_version == other.table_detection_model_version &&
    errors == other.errors &&
    searchable_pdf == other.searchable_pdf
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 221

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


201
202
203
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 201

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



210
211
212
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 210

def hash
  [, pages, detected_document_types, detected_languages, document_classification_model_version, language_classification_model_version, text_detection_model_version, key_value_detection_model_version, table_detection_model_version, errors, searchable_pdf].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



254
255
256
257
258
259
260
261
262
263
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 254

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



248
249
250
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 248

def to_s
  to_hash.to_s
end