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):



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
173
# File 'lib/oci/ai_vision/models/analyze_document_result.rb', line 110

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.



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

def detected_document_types
  @detected_document_types
end

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

An array of detected languages.



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

def detected_languages
  @detected_languages
end

#document_classification_model_versionString

The document classification model version.

Returns:

  • (String)


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

def document_classification_model_version
  @document_classification_model_version
end

#document_metadataOCI::AiVision::Models::DocumentMetadata

This attribute is required.



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

def 
  @document_metadata
end

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

The errors encountered during document analysis.



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

def errors
  @errors
end

#key_value_detection_model_versionString

The document keyValue detection model version.

Returns:

  • (String)


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

def key_value_detection_model_version
  @key_value_detection_model_version
end

#language_classification_model_versionString

The document language classification model version.

Returns:

  • (String)


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

def language_classification_model_version
  @language_classification_model_version
end

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

[Required] The array of a Page.

Returns:



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

def pages
  @pages
end

#searchable_pdfString

The searchable PDF file that was generated.

Returns:

  • (String)


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

def searchable_pdf
  @searchable_pdf
end

#table_detection_model_versionString

The document table detection model version.

Returns:

  • (String)


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

def table_detection_model_version
  @table_detection_model_version
end

#text_detection_model_versionString

The document text detection model version.

Returns:

  • (String)


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

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.



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

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.



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

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



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

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



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

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


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

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



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

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



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

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



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

def to_s
  to_hash.to_s
end