Class: Mindee::Product::InvoiceSplitter::InvoiceSplitterV1Document
- Inherits:
-
Mindee::Parsing::Common::Prediction
- Object
- Mindee::Parsing::Common::Prediction
- Mindee::Product::InvoiceSplitter::InvoiceSplitterV1Document
- Defined in:
- lib/mindee/product/invoice_splitter/invoice_splitter_v1_document.rb
Overview
Invoice Splitter V1 document prediction.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#invoice_page_groups ⇒ Object
readonly
-
#construct_invoice_page_groups_from_prediction(prediction) ⇒ Object
Reconstructs the page groups of a prediction.
-
#initialize(prediction, _page_id) ⇒ InvoiceSplitterV1Document
constructor
A new instance of InvoiceSplitterV1Document.
- #to_s ⇒ String
Constructor Details
#initialize(prediction, _page_id) ⇒ InvoiceSplitterV1Document
Returns a new instance of InvoiceSplitterV1Document.
37 38 39 40
# File 'lib/mindee/product/invoice_splitter/invoice_splitter_v1_document.rb', line 37 def initialize(prediction, _page_id) super() construct_invoice_page_groups_from_prediction(prediction) end
Instance Attribute Details
#invoice_page_groups ⇒ Object (readonly)
Instance Method Details
#construct_invoice_page_groups_from_prediction(prediction) ⇒ Object
Reconstructs the page groups of a prediction
44 45 46 47 48 49 50 51
# File 'lib/mindee/product/invoice_splitter/invoice_splitter_v1_document.rb', line 44 def construct_invoice_page_groups_from_prediction(prediction) @invoice_page_groups = [] return unless prediction.key?('invoice_page_groups') && prediction['invoice_page_groups'].any? prediction['invoice_page_groups'].each do |page_group_prediction| @invoice_page_groups.append(InvoiceSplitterV1PageGroup.new(page_group_prediction)) end end
#to_s ⇒ String
54 55 56 57 58 59 60 61 62 63
# File 'lib/mindee/product/invoice_splitter/invoice_splitter_v1_document.rb', line 54 def to_s out_str = String.new out_str << "\n:Invoice Page Groups:" if !@invoice_page_groups.nil? && @invoice_page_groups.any? @invoice_page_groups.map do |page| out_str << "\n #{page}" end end out_str[1..].to_s end
-
#construct_invoice_page_groups_from_prediction(prediction) ⇒ Object