Class: Mindee::Parsing::Custom::ListFieldItem
- Inherits:
-
Object
- Object
- Mindee::Parsing::Custom::ListFieldItem
- Defined in:
- lib/mindee/parsing/custom/list_field.rb
Overview
Field in a list.
Instance Attribute Summary collapse
- #bounding_box ⇒ Mindee::Geometry::Quadrilateral readonly
-
#confidence ⇒ Float
The confidence score, value will be between 0.0 and 1.0.
- #content ⇒ Array, ... readonly
- #page_id ⇒ Integer? readonly
- #polygon ⇒ Mindee::Geometry::Polygon readonly
Instance Method Summary collapse
-
#initialize(prediction, page_id: nil) ⇒ ListFieldItem
constructor
A new instance of ListFieldItem.
- #to_s ⇒ String
Constructor Details
#initialize(prediction, page_id: nil) ⇒ ListFieldItem
Returns a new instance of ListFieldItem.
21 22 23 24 25 26 27 |
# File 'lib/mindee/parsing/custom/list_field.rb', line 21 def initialize(prediction, page_id: nil) @content = prediction['content'] @confidence = prediction['confidence'] @polygon = Geometry.polygon_from_prediction(prediction['polygon']) @bounding_box = Geometry.get_bounding_box(@polygon) unless @polygon.nil? || @polygon.empty? @page_id = page_id end |
Instance Attribute Details
#bounding_box ⇒ Mindee::Geometry::Quadrilateral (readonly)
12 13 14 |
# File 'lib/mindee/parsing/custom/list_field.rb', line 12 def bounding_box @bounding_box end |
#confidence ⇒ Float
The confidence score, value will be between 0.0 and 1.0
10 11 12 |
# File 'lib/mindee/parsing/custom/list_field.rb', line 10 def confidence @confidence end |
#content ⇒ Array, ... (readonly)
16 17 18 |
# File 'lib/mindee/parsing/custom/list_field.rb', line 16 def content @content end |
#page_id ⇒ Integer? (readonly)
18 19 20 |
# File 'lib/mindee/parsing/custom/list_field.rb', line 18 def page_id @page_id end |
#polygon ⇒ Mindee::Geometry::Polygon (readonly)
14 15 16 |
# File 'lib/mindee/parsing/custom/list_field.rb', line 14 def polygon @polygon end |
Instance Method Details
#to_s ⇒ String
30 31 32 |
# File 'lib/mindee/parsing/custom/list_field.rb', line 30 def to_s @content.to_s end |