Class: Mindee::Parsing::Custom::ClassificationField

Inherits:
Object
  • Object
show all
Defined in:
lib/mindee/parsing/custom/classification_field.rb

Overview

Document classification (custom docs)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prediction) ⇒ ClassificationField

Returns a new instance of ClassificationField.

Parameters:

  • prediction (Hash)


16
17
18
19
# File 'lib/mindee/parsing/custom/classification_field.rb', line 16

def initialize(prediction)
  @value = prediction['value']
  @confidence = prediction['confidence']
end

Instance Attribute Details

#confidenceFloat

The confidence score, value will be between 0.0 and 1.0

Returns:

  • (Float)


13
14
15
# File 'lib/mindee/parsing/custom/classification_field.rb', line 13

def confidence
  @confidence
end

#valueString (readonly)

The classification value

Returns:

  • (String)


10
11
12
# File 'lib/mindee/parsing/custom/classification_field.rb', line 10

def value
  @value
end

Instance Method Details

#to_sString

Returns:

  • (String)


22
23
24
# File 'lib/mindee/parsing/custom/classification_field.rb', line 22

def to_s
  @value.nil? ? '' : @value
end