mindee 3.19.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/CHANGELOG.md +28 -0
- data/README.md +42 -52
- data/Steepfile +31 -0
- data/bin/mindee.rb +30 -62
- data/docs/advanced_file_operations.md +111 -0
- data/docs/code_samples/bank_account_details_v1.txt +5 -0
- data/docs/code_samples/bank_account_details_v2.txt +5 -0
- data/docs/code_samples/bank_check_v1.txt +5 -0
- data/docs/code_samples/{us_driver_license_v1.txt → bank_statement_fr_v2_async.txt} +6 -1
- data/docs/code_samples/barcode_reader_v1.txt +5 -0
- data/docs/code_samples/bill_of_lading_v1_async.txt +6 -1
- data/docs/code_samples/business_card_v1_async.txt +6 -1
- data/docs/code_samples/carte_grise_v1.txt +5 -0
- data/docs/code_samples/cropper_v1.txt +5 -0
- data/docs/code_samples/default.txt +8 -2
- data/docs/code_samples/default_async.txt +7 -2
- data/docs/code_samples/delivery_notes_v1_async.txt +6 -1
- data/docs/code_samples/driver_license_v1_async.txt +6 -1
- data/docs/code_samples/energy_bill_fra_v1_async.txt +6 -1
- data/docs/code_samples/expense_receipts_v5.txt +7 -1
- data/docs/code_samples/expense_receipts_v5_async.txt +6 -1
- data/docs/code_samples/financial_document_v1.txt +7 -1
- data/docs/code_samples/financial_document_v1_async.txt +6 -1
- data/docs/code_samples/french_healthcard_v1_async.txt +6 -1
- data/docs/code_samples/idcard_fr_v1.txt +5 -0
- data/docs/code_samples/idcard_fr_v2.txt +5 -0
- data/docs/code_samples/ind_passport_v1_async.txt +6 -1
- data/docs/code_samples/international_id_v2_async.txt +6 -1
- data/docs/code_samples/invoice_splitter_v1_async.txt +6 -1
- data/docs/code_samples/invoices_v4.txt +7 -1
- data/docs/code_samples/invoices_v4_async.txt +6 -1
- data/docs/code_samples/license_plates_v1.txt +5 -0
- data/docs/code_samples/multi_receipts_detector_v1.txt +5 -0
- data/docs/code_samples/nutrition_facts_v1_async.txt +6 -1
- data/docs/code_samples/passport_v1.txt +5 -0
- data/docs/code_samples/payslip_fra_v2_async.txt +6 -1
- data/docs/code_samples/payslip_fra_v3_async.txt +6 -1
- data/docs/code_samples/resume_v1_async.txt +6 -1
- data/docs/code_samples/us_healthcare_cards_v1_async.txt +6 -1
- data/docs/code_samples/us_mail_v3_async.txt +6 -1
- data/docs/code_samples/us_w9_v1.txt +5 -0
- data/docs/getting_started.md +50 -118
- data/docs/{barcode_reader_v1.md → global_products/barcode_reader_v1.md} +26 -9
- data/docs/{bill_of_lading_v1.md → global_products/bill_of_lading_v1.md} +62 -37
- data/docs/{business_card_v1.md → global_products/business_card_v1.md} +35 -10
- data/docs/{cropper_v1.md → global_products/cropper_v1.md} +32 -13
- data/docs/{delivery_notes_v1.md → global_products/delivery_notes_v1.md} +35 -10
- data/docs/{driver_license_v1.md → global_products/driver_license_v1.md} +65 -9
- data/docs/{expense_receipts_v5.md → global_products/expense_receipts_v5.md} +57 -21
- data/docs/{financial_document_v1.md → global_products/financial_document_v1.md} +70 -33
- data/docs/{international_id_v2.md → global_products/international_id_v2.md} +39 -13
- data/docs/{invoice_splitter_v1.md → global_products/invoice_splitter_v1.md} +25 -6
- data/docs/{invoices_v4.md → global_products/invoices_v4.md} +70 -33
- data/docs/{multi_receipts_detector_v1.md → global_products/multi_receipts_detector_v1.md} +32 -13
- data/docs/{nutrition_facts_v1.md → global_products/nutrition_facts_v1.md} +103 -78
- data/docs/{passport_v1.md → global_products/passport_v1.md} +26 -9
- data/docs/{resume_v1.md → global_products/resume_v1.md} +72 -46
- data/docs/{generated_v1.md → global_products/universal.md} +39 -19
- data/docs/global_products.md +6 -0
- data/docs/loading_a_document.md +316 -0
- data/docs/{bank_account_details_v2.md → localized_products/bank_account_details_v2.md} +24 -7
- data/docs/{bank_check_v1.md → localized_products/bank_check_v1.md} +37 -18
- data/docs/localized_products/bank_statement_fr_v2.md +269 -0
- data/docs/{carte_grise_v1.md → localized_products/carte_grise_v1.md} +25 -8
- data/docs/{energy_bill_fra_v1.md → localized_products/energy_bill_fra_v1.md} +70 -45
- data/docs/{french_healthcard_v1.md → localized_products/french_healthcard_v1.md} +36 -11
- data/docs/{idcard_fr_v2.md → localized_products/idcard_fr_v2.md} +34 -16
- data/docs/{ind_passport_v1.md → localized_products/ind_passport_v1.md} +37 -11
- data/docs/{license_plates_v1.md → localized_products/license_plates_v1.md} +25 -8
- data/docs/{payslip_fra_v3.md → localized_products/payslip_fra_v3.md} +80 -55
- data/docs/{us_healthcare_cards_v1.md → localized_products/us_healthcare_cards_v1.md} +37 -12
- data/docs/{us_mail_v3.md → localized_products/us_mail_v3.md} +49 -24
- data/docs/{us_w9_v1.md → localized_products/us_w9_v1.md} +64 -45
- data/docs/localized_products.md +6 -0
- data/examples/auto_invoice_splitter_extraction.rb +5 -5
- data/examples/auto_multi_receipts_detector_extraction.rb +4 -5
- data/lib/mindee/client.rb +354 -209
- data/lib/mindee/errors/mindee_error.rb +17 -0
- data/lib/mindee/errors/mindee_http_error.rb +36 -0
- data/lib/mindee/errors/mindee_input_error.rb +30 -0
- data/lib/mindee/errors.rb +5 -0
- data/lib/mindee/extraction/multi_receipts_extractor.rb +28 -1
- data/lib/mindee/extraction.rb +0 -3
- data/lib/mindee/geometry/polygon.rb +1 -1
- data/lib/mindee/geometry/utils.rb +1 -1
- data/lib/mindee/http/endpoint.rb +48 -40
- data/lib/mindee/http/{error.rb → http_error_handler.rb} +5 -35
- data/lib/mindee/http/response_validation.rb +2 -2
- data/lib/mindee/http/workflow_endpoint.rb +12 -12
- data/lib/mindee/http.rb +1 -1
- data/lib/mindee/{extraction/common → image}/extracted_image.rb +22 -18
- data/lib/mindee/{extraction/common → image}/image_extractor.rb +20 -78
- data/lib/mindee/image/image_utils.rb +68 -7
- data/lib/mindee/image.rb +2 -0
- data/lib/mindee/input/local_response.rb +8 -8
- data/lib/mindee/input/sources/base64_input_source.rb +6 -6
- data/lib/mindee/input/sources/bytes_input_source.rb +3 -3
- data/lib/mindee/input/sources/file_input_source.rb +3 -3
- data/lib/mindee/input/sources/local_input_source.rb +43 -41
- data/lib/mindee/input/sources/path_input_source.rb +3 -3
- data/lib/mindee/input/sources/url_input_source.rb +11 -8
- data/lib/mindee/logging/logger.rb +16 -0
- data/lib/mindee/logging.rb +3 -0
- data/lib/mindee/parsing/common/api_request.rb +36 -0
- data/lib/mindee/parsing/common/api_response.rb +6 -96
- data/lib/mindee/parsing/common/document.rb +12 -8
- data/lib/mindee/parsing/common/execution.rb +4 -2
- data/lib/mindee/parsing/common/execution_priority.rb +6 -0
- data/lib/mindee/parsing/common/extras/cropper_extra.rb +2 -1
- data/lib/mindee/parsing/common/extras/extras.rb +9 -4
- data/lib/mindee/parsing/common/extras/full_text_ocr_extra.rb +1 -0
- data/lib/mindee/parsing/common/inference.rb +23 -4
- data/lib/mindee/parsing/common/job.rb +46 -0
- data/lib/mindee/parsing/common/ocr/mvision_v1.rb +6 -6
- data/lib/mindee/parsing/common/ocr/ocr.rb +29 -29
- data/lib/mindee/parsing/common/page.rb +5 -3
- data/lib/mindee/parsing/common/prediction.rb +2 -0
- data/lib/mindee/parsing/common/workflow_response.rb +28 -0
- data/lib/mindee/parsing/common.rb +3 -0
- data/lib/mindee/parsing/standard/abstract_field.rb +72 -0
- data/lib/mindee/parsing/standard/amount_field.rb +2 -2
- data/lib/mindee/parsing/standard/base_field.rb +5 -84
- data/lib/mindee/parsing/standard/boolean_field.rb +4 -3
- data/lib/mindee/parsing/standard/classification_field.rb +1 -1
- data/lib/mindee/parsing/standard/company_registration_field.rb +7 -2
- data/lib/mindee/parsing/standard/date_field.rb +2 -2
- data/lib/mindee/parsing/standard/feature_field.rb +24 -0
- data/lib/mindee/parsing/standard/payment_details_field.rb +2 -2
- data/lib/mindee/parsing/standard/position_field.rb +3 -1
- data/lib/mindee/parsing/standard/string_field.rb +1 -1
- data/lib/mindee/parsing/standard/tax_field.rb +1 -1
- data/lib/mindee/parsing/standard.rb +1 -0
- data/lib/mindee/parsing/{generated/generated_list_field.rb → universal/universal_list_field.rb} +12 -12
- data/lib/mindee/parsing/{generated/generated_object_field.rb → universal/universal_object_field.rb} +23 -14
- data/lib/mindee/parsing/universal.rb +4 -0
- data/lib/mindee/parsing.rb +1 -2
- data/lib/mindee/{extraction/pdf_extractor → pdf}/extracted_pdf.rb +15 -12
- data/lib/mindee/pdf/pdf_compressor.rb +12 -10
- data/lib/mindee/{extraction/pdf_extractor → pdf}/pdf_extractor.rb +20 -17
- data/lib/mindee/pdf/pdf_processor.rb +12 -22
- data/lib/mindee/pdf/pdf_tools.rb +52 -6
- data/lib/mindee/pdf.rb +2 -0
- data/lib/mindee/product/.rubocop.yml +3 -0
- data/lib/mindee/product/barcode_reader/barcode_reader_v1.rb +9 -3
- data/lib/mindee/product/barcode_reader/barcode_reader_v1_document.rb +5 -5
- data/lib/mindee/product/barcode_reader/barcode_reader_v1_page.rb +9 -5
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1.rb +9 -3
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rb +1 -1
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_item.rb +13 -7
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_items.rb +62 -0
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_consignee.rb +1 -1
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb +44 -17
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_notify_party.rb +1 -1
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_page.rb +9 -5
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_shipper.rb +1 -1
- data/lib/mindee/product/business_card/business_card_v1.rb +9 -3
- data/lib/mindee/product/business_card/business_card_v1_document.rb +40 -13
- data/lib/mindee/product/business_card/business_card_v1_page.rb +9 -5
- data/lib/mindee/product/cropper/cropper_v1.rb +10 -4
- data/lib/mindee/product/cropper/cropper_v1_page.rb +11 -7
- data/lib/mindee/product/delivery_note/delivery_note_v1.rb +9 -3
- data/lib/mindee/product/delivery_note/delivery_note_v1_document.rb +29 -8
- data/lib/mindee/product/delivery_note/delivery_note_v1_page.rb +9 -5
- data/lib/mindee/product/driver_license/driver_license_v1.rb +9 -3
- data/lib/mindee/product/driver_license/driver_license_v1_document.rb +44 -14
- data/lib/mindee/product/driver_license/driver_license_v1_page.rb +9 -5
- data/lib/mindee/product/eu/license_plate/license_plate_v1.rb +9 -3
- data/lib/mindee/product/eu/license_plate/license_plate_v1_document.rb +3 -3
- data/lib/mindee/product/eu/license_plate/license_plate_v1_page.rb +9 -5
- data/lib/mindee/product/financial_document/financial_document_v1.rb +9 -3
- data/lib/mindee/product/financial_document/financial_document_v1_document.rb +110 -42
- data/lib/mindee/product/financial_document/financial_document_v1_line_item.rb +21 -11
- data/lib/mindee/product/financial_document/financial_document_v1_line_items.rb +62 -0
- data/lib/mindee/product/financial_document/financial_document_v1_page.rb +9 -5
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1.rb +9 -3
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1_document.rb +7 -4
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1_page.rb +9 -5
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2.rb +9 -3
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_bban.rb +1 -1
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_document.rb +11 -5
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_page.rb +9 -5
- data/lib/mindee/product/fr/bank_statement/bank_statement_v2.rb +47 -0
- data/lib/mindee/product/fr/bank_statement/{bank_statement_v1_document.rb → bank_statement_v2_document.rb} +62 -26
- data/lib/mindee/product/fr/bank_statement/bank_statement_v2_page.rb +38 -0
- data/lib/mindee/product/fr/bank_statement/{bank_statement_v1_transaction.rb → bank_statement_v2_transaction.rb} +17 -6
- data/lib/mindee/product/fr/bank_statement/bank_statement_v2_transactions.rb +54 -0
- data/lib/mindee/product/fr/carte_grise/carte_grise_v1.rb +9 -3
- data/lib/mindee/product/fr/carte_grise/carte_grise_v1_document.rb +51 -42
- data/lib/mindee/product/fr/carte_grise/carte_grise_v1_page.rb +9 -5
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1.rb +9 -3
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb +56 -30
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_consumer.rb +1 -1
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_supplier.rb +1 -1
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.rb +13 -7
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_usages.rb +65 -0
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.rb +1 -1
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_page.rb +9 -5
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb +13 -7
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_subscriptions.rb +65 -0
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contribution.rb +13 -7
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contributions.rb +65 -0
- data/lib/mindee/product/fr/health_card/health_card_v1.rb +9 -3
- data/lib/mindee/product/fr/health_card/health_card_v1_document.rb +15 -6
- data/lib/mindee/product/fr/health_card/health_card_v1_page.rb +9 -5
- data/lib/mindee/product/fr/id_card/id_card_v1.rb +9 -3
- data/lib/mindee/product/fr/id_card/id_card_v1_document.rb +33 -12
- data/lib/mindee/product/fr/id_card/id_card_v1_page.rb +14 -7
- data/lib/mindee/product/fr/id_card/id_card_v2.rb +9 -3
- data/lib/mindee/product/fr/id_card/id_card_v2_document.rb +50 -17
- data/lib/mindee/product/fr/id_card/id_card_v2_page.rb +18 -8
- data/lib/mindee/product/fr/payslip/payslip_v2.rb +9 -3
- data/lib/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rb +1 -1
- data/lib/mindee/product/fr/payslip/payslip_v2_document.rb +29 -14
- data/lib/mindee/product/fr/payslip/payslip_v2_employee.rb +1 -1
- data/lib/mindee/product/fr/payslip/payslip_v2_employer.rb +1 -1
- data/lib/mindee/product/fr/payslip/payslip_v2_employment.rb +3 -2
- data/lib/mindee/product/fr/payslip/payslip_v2_page.rb +9 -5
- data/lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb +33 -11
- data/lib/mindee/product/fr/payslip/payslip_v2_pay_period.rb +1 -1
- data/lib/mindee/product/fr/payslip/payslip_v2_pto.rb +13 -4
- data/lib/mindee/product/fr/payslip/payslip_v2_salary_detail.rb +13 -7
- data/lib/mindee/product/fr/payslip/payslip_v2_salary_details.rb +63 -0
- data/lib/mindee/product/fr/payslip/payslip_v3.rb +9 -3
- data/lib/mindee/product/fr/payslip/payslip_v3_bank_account_detail.rb +1 -1
- data/lib/mindee/product/fr/payslip/payslip_v3_document.rb +31 -19
- data/lib/mindee/product/fr/payslip/payslip_v3_employee.rb +1 -1
- data/lib/mindee/product/fr/payslip/payslip_v3_employer.rb +1 -1
- data/lib/mindee/product/fr/payslip/payslip_v3_employment.rb +1 -1
- data/lib/mindee/product/fr/payslip/payslip_v3_page.rb +9 -5
- data/lib/mindee/product/fr/payslip/payslip_v3_paid_time_off.rb +13 -7
- data/lib/mindee/product/fr/payslip/payslip_v3_paid_time_offs.rb +65 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_pay_detail.rb +33 -11
- data/lib/mindee/product/fr/payslip/payslip_v3_pay_period.rb +1 -1
- data/lib/mindee/product/fr/payslip/payslip_v3_salary_detail.rb +17 -9
- data/lib/mindee/product/fr/payslip/payslip_v3_salary_details.rb +65 -0
- data/lib/mindee/product/ind/indian_passport/indian_passport_v1.rb +9 -3
- data/lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb +87 -24
- data/lib/mindee/product/ind/indian_passport/indian_passport_v1_page.rb +9 -5
- data/lib/mindee/product/international_id/international_id_v2.rb +9 -3
- data/lib/mindee/product/international_id/international_id_v2_document.rb +62 -20
- data/lib/mindee/product/international_id/international_id_v2_page.rb +9 -5
- data/lib/mindee/product/invoice/invoice_v4.rb +9 -3
- data/lib/mindee/product/invoice/invoice_v4_document.rb +90 -36
- data/lib/mindee/product/invoice/invoice_v4_line_item.rb +21 -11
- data/lib/mindee/product/invoice/invoice_v4_line_items.rb +62 -0
- data/lib/mindee/product/invoice/invoice_v4_page.rb +9 -5
- data/lib/mindee/product/invoice_splitter/invoice_splitter_v1.rb +8 -0
- data/lib/mindee/product/invoice_splitter/invoice_splitter_v1_document.rb +2 -2
- data/lib/mindee/product/invoice_splitter/invoice_splitter_v1_page.rb +1 -1
- data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1.rb +9 -3
- data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rb +3 -3
- data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_page.rb +9 -5
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1.rb +9 -3
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_added_sugar.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_calorie.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_cholesterol.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_dietary_fiber.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_document.rb +58 -20
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrient.rb +13 -7
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrients.rb +68 -0
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_page.rb +9 -5
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_protein.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_saturated_fat.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_serving_size.rb +3 -2
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_sodium.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_carbohydrate.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_fat.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_sugar.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_trans_fat.rb +7 -4
- data/lib/mindee/product/passport/passport_v1.rb +9 -3
- data/lib/mindee/product/passport/passport_v1_document.rb +37 -13
- data/lib/mindee/product/passport/passport_v1_page.rb +9 -5
- data/lib/mindee/product/receipt/receipt_v5.rb +9 -3
- data/lib/mindee/product/receipt/receipt_v5_document.rb +54 -24
- data/lib/mindee/product/receipt/receipt_v5_line_item.rb +13 -7
- data/lib/mindee/product/receipt/receipt_v5_line_items.rb +54 -0
- data/lib/mindee/product/receipt/receipt_v5_page.rb +9 -5
- data/lib/mindee/product/resume/resume_v1.rb +9 -3
- data/lib/mindee/product/resume/resume_v1_certificate.rb +1 -1
- data/lib/mindee/product/resume/resume_v1_certificates.rb +58 -0
- data/lib/mindee/product/resume/resume_v1_document.rb +60 -47
- data/lib/mindee/product/resume/resume_v1_education.rb +1 -1
- data/lib/mindee/product/resume/resume_v1_educations.rb +64 -0
- data/lib/mindee/product/resume/resume_v1_language.rb +1 -1
- data/lib/mindee/product/resume/resume_v1_languages.rb +54 -0
- data/lib/mindee/product/resume/resume_v1_page.rb +9 -5
- data/lib/mindee/product/resume/resume_v1_professional_experience.rb +1 -1
- data/lib/mindee/product/resume/resume_v1_professional_experiences.rb +68 -0
- data/lib/mindee/product/resume/resume_v1_social_networks_url.rb +1 -1
- data/lib/mindee/product/resume/resume_v1_social_networks_urls.rb +54 -0
- data/lib/mindee/product/universal/universal.rb +46 -0
- data/lib/mindee/product/universal/universal_document.rb +32 -0
- data/lib/mindee/product/{generated/generated_v1_page.rb → universal/universal_page.rb} +14 -14
- data/lib/mindee/product/{generated/generated_v1_prediction.rb → universal/universal_prediction.rb} +32 -24
- data/lib/mindee/product/us/bank_check/bank_check_v1.rb +9 -3
- data/lib/mindee/product/us/bank_check/bank_check_v1_document.rb +20 -8
- data/lib/mindee/product/us/bank_check/bank_check_v1_page.rb +15 -8
- data/lib/mindee/product/us/healthcare_card/healthcare_card_v1.rb +9 -3
- data/lib/mindee/product/us/healthcare_card/healthcare_card_v1_copay.rb +5 -3
- data/lib/mindee/product/us/healthcare_card/healthcare_card_v1_copays.rb +52 -0
- data/lib/mindee/product/us/healthcare_card/healthcare_card_v1_document.rb +46 -19
- data/lib/mindee/product/us/healthcare_card/healthcare_card_v1_page.rb +9 -5
- data/lib/mindee/product/us/us_mail/us_mail_v3.rb +9 -3
- data/lib/mindee/product/us/us_mail/us_mail_v3_document.rb +20 -12
- data/lib/mindee/product/us/us_mail/us_mail_v3_page.rb +9 -5
- data/lib/mindee/product/us/us_mail/us_mail_v3_recipient_address.rb +2 -2
- data/lib/mindee/product/us/us_mail/us_mail_v3_recipient_addresses.rb +65 -0
- data/lib/mindee/product/us/us_mail/us_mail_v3_sender_address.rb +1 -1
- data/lib/mindee/product/us/w9/w9_v1.rb +10 -4
- data/lib/mindee/product/us/w9/w9_v1_page.rb +49 -18
- data/lib/mindee/product.rb +2 -8
- data/lib/mindee/version.rb +2 -2
- data/lib/mindee.rb +22 -9
- data/mindee.gemspec +19 -17
- data/sig/custom/marcel.rbs +3 -0
- data/sig/custom/mini_magick.rbs +24 -0
- data/sig/custom/net_http.rbs +34 -0
- data/sig/custom/origami.rbs +54 -0
- data/sig/mindee/client.rbs +63 -0
- data/sig/mindee/errors/mindee_error.rbs +13 -0
- data/sig/mindee/errors/mindee_http_error.rbs +16 -0
- data/sig/mindee/errors/mindee_input_error.rbs +17 -0
- data/sig/mindee/extraction/multi_receipts_extractor.rbs +6 -0
- data/sig/mindee/geometry/min_max.rbs +10 -0
- data/sig/mindee/geometry/point.rbs +13 -0
- data/sig/mindee/geometry/polygon.rbs +9 -0
- data/sig/mindee/geometry/quadrilateral.rbs +18 -0
- data/sig/mindee/geometry/utils.rbs +13 -0
- data/sig/mindee/http/endpoint.rbs +26 -0
- data/sig/mindee/http/http_error_handler.rbs +10 -0
- data/sig/mindee/http/response_validation.rbs +10 -0
- data/sig/mindee/http/workflow_endpoint.rbs +14 -0
- data/sig/mindee/image/extracted_image.rbs +15 -0
- data/sig/mindee/image/image_compressor.rbs +8 -0
- data/sig/mindee/image/image_extractor.rbs +13 -0
- data/sig/mindee/image/image_utils.rbs +19 -0
- data/sig/mindee/input/local_response.rbs +13 -0
- data/sig/mindee/input/sources/base64_input_source.rbs +11 -0
- data/sig/mindee/input/sources/bytes_input_source.rbs +10 -0
- data/sig/mindee/input/sources/file_input_source.rbs +10 -0
- data/sig/mindee/input/sources/local_input_source.rbs +24 -0
- data/sig/mindee/input/sources/path_input_source.rbs +10 -0
- data/sig/mindee/input/sources/url_input_source.rbs +20 -0
- data/sig/mindee/logging/logger.rbs +9 -0
- data/sig/mindee/parsing/common/api_request.rbs +15 -0
- data/sig/mindee/parsing/common/api_response.rbs +27 -0
- data/sig/mindee/parsing/common/document.rbs +20 -0
- data/sig/mindee/parsing/common/execution.rbs +23 -0
- data/sig/mindee/parsing/common/execution_file.rbs +12 -0
- data/sig/mindee/parsing/common/execution_priority.rbs +13 -0
- data/sig/mindee/parsing/common/extras/cropper_extra.rbs +14 -0
- data/sig/mindee/parsing/common/extras/extras.rbs +18 -0
- data/sig/mindee/parsing/common/extras/full_text_ocr_extra.rbs +15 -0
- data/sig/mindee/parsing/common/inference.rbs +19 -0
- data/sig/mindee/parsing/common/job.rbs +16 -0
- data/sig/mindee/parsing/common/ocr/mvision_v1.rbs +15 -0
- data/sig/mindee/parsing/common/ocr/ocr.rbs +39 -0
- data/sig/mindee/parsing/common/orientation.rbs +12 -0
- data/sig/mindee/parsing/common/page.rbs +15 -0
- data/sig/mindee/parsing/common/prediction.rbs +11 -0
- data/sig/mindee/parsing/common/product.rbs +13 -0
- data/sig/mindee/parsing/common/workflow_response.rbs +13 -0
- data/sig/mindee/parsing/standard/abstract_field.rbs +19 -0
- data/sig/mindee/parsing/standard/amount_field.rbs +12 -0
- data/sig/mindee/parsing/standard/base_field.rbs +12 -0
- data/sig/mindee/parsing/standard/boolean_field.rbs +12 -0
- data/sig/mindee/parsing/standard/classification_field.rbs +10 -0
- data/sig/mindee/parsing/standard/company_registration_field.rbs +14 -0
- data/sig/mindee/parsing/standard/date_field.rbs +14 -0
- data/sig/mindee/parsing/standard/feature_field.rbs +10 -0
- data/sig/mindee/parsing/standard/locale_field.rbs +16 -0
- data/sig/mindee/parsing/standard/payment_details_field.rbs +15 -0
- data/sig/mindee/parsing/standard/position_field.rbs +17 -0
- data/sig/mindee/parsing/standard/string_field.rbs +12 -0
- data/sig/mindee/parsing/standard/tax_field.rbs +23 -0
- data/sig/mindee/parsing/universal/universal_list_field.rbs +17 -0
- data/sig/mindee/parsing/universal/universal_object_field.rbs +23 -0
- data/sig/mindee/pdf/extracted_pdf.rbs +15 -0
- data/sig/mindee/pdf/pdf_compressor.rbs +15 -0
- data/sig/mindee/pdf/pdf_extractor.rbs +16 -0
- data/sig/mindee/pdf/pdf_processor.rbs +12 -0
- data/sig/mindee/pdf/pdf_tools.rbs +23 -0
- data/sig/mindee/product/barcode_reader/barcode_reader_v1.rbs +11 -0
- data/sig/mindee/product/barcode_reader/barcode_reader_v1_document.rbs +14 -0
- data/sig/mindee/product/barcode_reader/barcode_reader_v1_page.rbs +15 -0
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1.rbs +11 -0
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rbs +14 -0
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_item.rbs +19 -0
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_items.rbs +13 -0
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_consignee.rbs +15 -0
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_document.rbs +25 -0
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_notify_party.rbs +15 -0
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_page.rbs +15 -0
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_shipper.rbs +15 -0
- data/sig/mindee/product/business_card/business_card_v1.rbs +11 -0
- data/sig/mindee/product/business_card/business_card_v1_document.rbs +23 -0
- data/sig/mindee/product/business_card/business_card_v1_page.rbs +15 -0
- data/sig/mindee/product/cropper/cropper_v1.rbs +11 -0
- data/sig/mindee/product/cropper/cropper_v1_document.rbs +12 -0
- data/sig/mindee/product/cropper/cropper_v1_page.rbs +16 -0
- data/sig/mindee/product/delivery_note/delivery_note_v1.rbs +11 -0
- data/sig/mindee/product/delivery_note/delivery_note_v1_document.rbs +19 -0
- data/sig/mindee/product/delivery_note/delivery_note_v1_page.rbs +15 -0
- data/sig/mindee/product/driver_license/driver_license_v1.rbs +11 -0
- data/sig/mindee/product/driver_license/driver_license_v1_document.rbs +25 -0
- data/sig/mindee/product/driver_license/driver_license_v1_page.rbs +15 -0
- data/sig/mindee/product/eu/license_plate/license_plate_v1.rbs +13 -0
- data/sig/mindee/product/eu/license_plate/license_plate_v1_document.rbs +15 -0
- data/sig/mindee/product/eu/license_plate/license_plate_v1_page.rbs +17 -0
- data/sig/mindee/product/financial_document/financial_document_v1.rbs +11 -0
- data/sig/mindee/product/financial_document/financial_document_v1_document.rbs +46 -0
- data/sig/mindee/product/financial_document/financial_document_v1_line_item.rbs +21 -0
- data/sig/mindee/product/financial_document/financial_document_v1_line_items.rbs +13 -0
- data/sig/mindee/product/financial_document/financial_document_v1_page.rbs +15 -0
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v1.rbs +13 -0
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v1_document.rbs +17 -0
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v1_page.rbs +17 -0
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v2.rbs +13 -0
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_bban.rbs +17 -0
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_document.rbs +18 -0
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_page.rbs +17 -0
- data/sig/mindee/product/fr/bank_statement/bank_statement_v2.rbs +13 -0
- data/sig/mindee/product/fr/bank_statement/bank_statement_v2_document.rbs +29 -0
- data/sig/mindee/product/fr/bank_statement/bank_statement_v2_page.rbs +17 -0
- data/sig/mindee/product/fr/bank_statement/bank_statement_v2_transaction.rbs +18 -0
- data/sig/mindee/product/fr/bank_statement/bank_statement_v2_transactions.rbs +15 -0
- data/sig/mindee/product/fr/carte_grise/carte_grise_v1.rbs +13 -0
- data/sig/mindee/product/fr/carte_grise/carte_grise_v1_document.rbs +55 -0
- data/sig/mindee/product/fr/carte_grise/carte_grise_v1_page.rbs +17 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1.rbs +13 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_document.rbs +34 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_consumer.rbs +15 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_supplier.rbs +15 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.rbs +21 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_usages.rbs +15 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.rbs +16 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_page.rbs +17 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rbs +21 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_subscriptions.rbs +15 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contribution.rbs +21 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contributions.rbs +15 -0
- data/sig/mindee/product/fr/health_card/health_card_v1.rbs +13 -0
- data/sig/mindee/product/fr/health_card/health_card_v1_document.rbs +18 -0
- data/sig/mindee/product/fr/health_card/health_card_v1_page.rbs +17 -0
- data/sig/mindee/product/fr/id_card/id_card_v1.rbs +13 -0
- data/sig/mindee/product/fr/id_card/id_card_v1_document.rbs +24 -0
- data/sig/mindee/product/fr/id_card/id_card_v1_page.rbs +18 -0
- data/sig/mindee/product/fr/id_card/id_card_v2.rbs +13 -0
- data/sig/mindee/product/fr/id_card/id_card_v2_document.rbs +29 -0
- data/sig/mindee/product/fr/id_card/id_card_v2_page.rbs +19 -0
- data/sig/mindee/product/fr/payslip/payslip_v2.rbs +13 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rbs +16 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_document.rbs +24 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_employee.rbs +20 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_employer.rbs +20 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_employment.rbs +19 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_page.rbs +17 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_pay_detail.rbs +23 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_pay_period.rbs +18 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_pto.rbs +16 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_salary_detail.rbs +19 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_salary_details.rbs +15 -0
- data/sig/mindee/product/fr/payslip/payslip_v3.rbs +13 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_bank_account_detail.rbs +16 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_document.rbs +26 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_employee.rbs +20 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_employer.rbs +20 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_employment.rbs +20 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_page.rbs +17 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_paid_time_off.rbs +20 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_paid_time_offs.rbs +15 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_pay_detail.rbs +23 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_pay_period.rbs +18 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_salary_detail.rbs +20 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_salary_details.rbs +15 -0
- data/sig/mindee/product/ind/indian_passport/indian_passport_v1.rbs +13 -0
- data/sig/mindee/product/ind/indian_passport/indian_passport_v1_document.rbs +37 -0
- data/sig/mindee/product/ind/indian_passport/indian_passport_v1_page.rbs +17 -0
- data/sig/mindee/product/international_id/international_id_v2.rbs +11 -0
- data/sig/mindee/product/international_id/international_id_v2_document.rbs +29 -0
- data/sig/mindee/product/international_id/international_id_v2_page.rbs +15 -0
- data/sig/mindee/product/invoice/invoice_v4.rbs +11 -0
- data/sig/mindee/product/invoice/invoice_v4_document.rbs +40 -0
- data/sig/mindee/product/invoice/invoice_v4_line_item.rbs +21 -0
- data/sig/mindee/product/invoice/invoice_v4_line_items.rbs +13 -0
- data/sig/mindee/product/invoice/invoice_v4_page.rbs +15 -0
- data/sig/mindee/product/invoice_splitter/invoice_splitter_v1.rbs +14 -0
- data/sig/mindee/product/invoice_splitter/invoice_splitter_v1_document.rbs +19 -0
- data/sig/mindee/product/invoice_splitter/invoice_splitter_v1_page.rbs +13 -0
- data/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1.rbs +11 -0
- data/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rbs +13 -0
- data/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_page.rbs +15 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1.rbs +11 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_added_sugar.rbs +14 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_calorie.rbs +14 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_cholesterol.rbs +14 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_dietary_fiber.rbs +14 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_document.rbs +28 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrient.rbs +18 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrients.rbs +13 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_page.rbs +15 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_protein.rbs +14 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_saturated_fat.rbs +14 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_serving_size.rbs +13 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_sodium.rbs +15 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_carbohydrate.rbs +14 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_fat.rbs +14 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_sugar.rbs +14 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_trans_fat.rbs +14 -0
- data/sig/mindee/product/passport/passport_v1.rbs +11 -0
- data/sig/mindee/product/passport/passport_v1_document.rbs +23 -0
- data/sig/mindee/product/passport/passport_v1_page.rbs +15 -0
- data/sig/mindee/product/receipt/receipt_v5.rbs +11 -0
- data/sig/mindee/product/receipt/receipt_v5_document.rbs +31 -0
- data/sig/mindee/product/receipt/receipt_v5_line_item.rbs +17 -0
- data/sig/mindee/product/receipt/receipt_v5_line_items.rbs +13 -0
- data/sig/mindee/product/receipt/receipt_v5_page.rbs +15 -0
- data/sig/mindee/product/resume/resume_v1.rbs +11 -0
- data/sig/mindee/product/resume/resume_v1_certificate.rbs +17 -0
- data/sig/mindee/product/resume/resume_v1_certificates.rbs +13 -0
- data/sig/mindee/product/resume/resume_v1_document.rbs +39 -0
- data/sig/mindee/product/resume/resume_v1_education.rbs +20 -0
- data/sig/mindee/product/resume/resume_v1_educations.rbs +13 -0
- data/sig/mindee/product/resume/resume_v1_language.rbs +15 -0
- data/sig/mindee/product/resume/resume_v1_languages.rbs +13 -0
- data/sig/mindee/product/resume/resume_v1_page.rbs +15 -0
- data/sig/mindee/product/resume/resume_v1_professional_experience.rbs +22 -0
- data/sig/mindee/product/resume/resume_v1_professional_experiences.rbs +13 -0
- data/sig/mindee/product/resume/resume_v1_social_networks_url.rbs +15 -0
- data/sig/mindee/product/resume/resume_v1_social_networks_urls.rbs +13 -0
- data/sig/mindee/product/universal/universal.rbs +14 -0
- data/sig/mindee/product/universal/universal_document.rbs +10 -0
- data/sig/mindee/product/universal/universal_page.rbs +14 -0
- data/sig/mindee/product/universal/universal_prediction.rbs +19 -0
- data/sig/mindee/product/us/bank_check/bank_check_v1.rbs +13 -0
- data/sig/mindee/product/us/bank_check/bank_check_v1_document.rbs +20 -0
- data/sig/mindee/product/us/bank_check/bank_check_v1_page.rbs +19 -0
- data/sig/mindee/product/us/healthcare_card/healthcare_card_v1.rbs +13 -0
- data/sig/mindee/product/us/healthcare_card/healthcare_card_v1_copay.rbs +17 -0
- data/sig/mindee/product/us/healthcare_card/healthcare_card_v1_copays.rbs +15 -0
- data/sig/mindee/product/us/healthcare_card/healthcare_card_v1_document.rbs +28 -0
- data/sig/mindee/product/us/healthcare_card/healthcare_card_v1_page.rbs +17 -0
- data/sig/mindee/product/us/us_mail/us_mail_v3.rbs +13 -0
- data/sig/mindee/product/us/us_mail/us_mail_v3_document.rbs +21 -0
- data/sig/mindee/product/us/us_mail/us_mail_v3_page.rbs +17 -0
- data/sig/mindee/product/us/us_mail/us_mail_v3_recipient_address.rbs +23 -0
- data/sig/mindee/product/us/us_mail/us_mail_v3_recipient_addresses.rbs +15 -0
- data/sig/mindee/product/us/us_mail/us_mail_v3_sender_address.rbs +18 -0
- data/sig/mindee/product/us/w9/w9_v1.rbs +13 -0
- data/sig/mindee/product/us/w9/w9_v1_document.rbs +14 -0
- data/sig/mindee/product/us/w9/w9_v1_page.rbs +29 -0
- data/sig/mindee/version.rbs +6 -0
- data/sig/mindee.rbs +59 -0
- metadata +395 -103
- data/docs/bank_statement_fr_v1.md +0 -178
- data/docs/code_samples/bank_statement_fr_v1_async.txt +0 -19
- data/docs/code_samples/custom_v1.txt +0 -33
- data/docs/code_samples/eu_driver_license_v1.txt +0 -19
- data/docs/code_samples/expense_receipts_v4.txt +0 -19
- data/docs/code_samples/proof_of_address_v1.txt +0 -19
- data/docs/code_samples/us_mail_v2_async.txt +0 -19
- data/docs/code_samples/workflow_execution.txt +0 -29
- data/docs/custom_v1.md +0 -111
- data/docs/payslip_fra_v2.md +0 -294
- data/lib/mindee/extraction/common.rb +0 -4
- data/lib/mindee/extraction/multi_receipts_extractor/multi_receipts_extractor.rb +0 -32
- data/lib/mindee/extraction/pdf_extractor.rb +0 -4
- data/lib/mindee/extraction/tax_extractor/ocr_extractor.rb +0 -110
- data/lib/mindee/extraction/tax_extractor/tax_extractor.rb +0 -338
- data/lib/mindee/extraction/tax_extractor.rb +0 -3
- data/lib/mindee/parsing/custom/classification_field.rb +0 -28
- data/lib/mindee/parsing/custom/list_field.rb +0 -78
- data/lib/mindee/parsing/custom.rb +0 -4
- data/lib/mindee/parsing/generated.rb +0 -4
- data/lib/mindee/product/custom/custom_v1.rb +0 -36
- data/lib/mindee/product/custom/custom_v1_document.rb +0 -60
- data/lib/mindee/product/custom/custom_v1_page.rb +0 -32
- data/lib/mindee/product/eu/driver_license/driver_license_v1.rb +0 -41
- data/lib/mindee/product/eu/driver_license/driver_license_v1_document.rb +0 -88
- data/lib/mindee/product/eu/driver_license/driver_license_v1_page.rb +0 -53
- data/lib/mindee/product/fr/bank_statement/bank_statement_v1.rb +0 -41
- data/lib/mindee/product/fr/bank_statement/bank_statement_v1_page.rb +0 -34
- data/lib/mindee/product/generated/generated_v1.rb +0 -38
- data/lib/mindee/product/generated/generated_v1_document.rb +0 -35
- data/lib/mindee/product/proof_of_address/proof_of_address_v1.rb +0 -39
- data/lib/mindee/product/proof_of_address/proof_of_address_v1_document.rb +0 -83
- data/lib/mindee/product/proof_of_address/proof_of_address_v1_page.rb +0 -32
- data/lib/mindee/product/receipt/receipt_v4.rb +0 -36
- data/lib/mindee/product/receipt/receipt_v4_document.rb +0 -86
- data/lib/mindee/product/receipt/receipt_v4_page.rb +0 -32
- data/lib/mindee/product/us/driver_license/driver_license_v1.rb +0 -41
- data/lib/mindee/product/us/driver_license/driver_license_v1_document.rb +0 -113
- data/lib/mindee/product/us/driver_license/driver_license_v1_page.rb +0 -53
- data/lib/mindee/product/us/us_mail/us_mail_v2.rb +0 -41
- data/lib/mindee/product/us/us_mail/us_mail_v2_document.rb +0 -100
- data/lib/mindee/product/us/us_mail/us_mail_v2_page.rb +0 -34
- data/lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb +0 -105
- data/lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb +0 -66
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mindee
|
4
|
+
module Parsing
|
5
|
+
module Common
|
6
|
+
# HTTP request response.
|
7
|
+
class ApiRequest
|
8
|
+
# @return [Hash]
|
9
|
+
attr_reader :error
|
10
|
+
# @return [Array<String>]
|
11
|
+
attr_reader :ressources
|
12
|
+
# @return [RequestStatus, Symbol]
|
13
|
+
attr_reader :status
|
14
|
+
# @return [Integer]
|
15
|
+
attr_reader :status_code
|
16
|
+
# @return [String]
|
17
|
+
attr_reader :url
|
18
|
+
|
19
|
+
def initialize(server_response)
|
20
|
+
@error = server_response['error']
|
21
|
+
@ressources = server_response['ressources']
|
22
|
+
|
23
|
+
@status = if server_response['status'] == 'failure'
|
24
|
+
RequestStatus::FAILURE
|
25
|
+
elsif server_response['status'] == 'success'
|
26
|
+
RequestStatus::SUCCESS
|
27
|
+
else
|
28
|
+
server_response['status']&.to_sym
|
29
|
+
end
|
30
|
+
@status_code = server_response['status_code']
|
31
|
+
@url = server_response['url']
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -1,21 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'document'
|
4
|
-
|
4
|
+
require_relative '../../logging'
|
5
5
|
|
6
6
|
module Mindee
|
7
7
|
module Parsing
|
8
8
|
module Common
|
9
9
|
# Potential values for queue in asynchronous calls.
|
10
10
|
module JobStatus
|
11
|
-
|
12
|
-
WAITING = :waiting
|
13
|
-
# Document is currently being parsed.
|
11
|
+
WAITING = :waiting
|
14
12
|
PROCESSING = :processing
|
15
|
-
|
16
|
-
|
17
|
-
# Job failed
|
18
|
-
FAILURE = :failed
|
13
|
+
COMPLETED = :completed
|
14
|
+
FAILURE = :failed
|
19
15
|
end
|
20
16
|
|
21
17
|
# Potential values for requests.
|
@@ -26,72 +22,6 @@ module Mindee
|
|
26
22
|
SUCCESS = :success
|
27
23
|
end
|
28
24
|
|
29
|
-
# Job (queue) information on async parsing.
|
30
|
-
class Job
|
31
|
-
# @return [String] Mindee ID of the document
|
32
|
-
attr_reader :id
|
33
|
-
# @return [Mindee::Parsing::Standard::DateField]
|
34
|
-
attr_reader :issued_at
|
35
|
-
# @return [Time, nil]
|
36
|
-
attr_reader :available_at
|
37
|
-
# @return [JobStatus, Symbol]
|
38
|
-
attr_reader :status
|
39
|
-
# @return [Integer, nil]
|
40
|
-
attr_reader :millisecs_taken
|
41
|
-
# @return [Hash, nil]
|
42
|
-
attr_reader :error
|
43
|
-
|
44
|
-
# @param http_response [Hash]
|
45
|
-
def initialize(http_response)
|
46
|
-
@id = http_response['id']
|
47
|
-
@error = http_response['error']
|
48
|
-
@issued_at = Time.iso8601(http_response['issued_at'])
|
49
|
-
if http_response.key?('available_at') && !http_response['available_at'].nil?
|
50
|
-
@available_at = Time.iso8601(http_response['available_at'])
|
51
|
-
@millisecs_taken = (1000 * (@available_at.to_time - @issued_at.to_time).to_f).to_i
|
52
|
-
end
|
53
|
-
@status = case http_response['status']
|
54
|
-
when 'waiting'
|
55
|
-
JobStatus::WAITING
|
56
|
-
when 'processing'
|
57
|
-
JobStatus::PROCESSING
|
58
|
-
when 'completed'
|
59
|
-
JobStatus::COMPLETED
|
60
|
-
else
|
61
|
-
http_response['status']&.to_sym
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
# HTTP request response.
|
67
|
-
class ApiRequest
|
68
|
-
# @return [Hash]
|
69
|
-
attr_reader :error
|
70
|
-
# @return [Array<String>]
|
71
|
-
attr_reader :ressources
|
72
|
-
# @return [RequestStatus, Symbol]
|
73
|
-
attr_reader :status
|
74
|
-
# @return [Integer]
|
75
|
-
attr_reader :status_code
|
76
|
-
# @return [String]
|
77
|
-
attr_reader :url
|
78
|
-
|
79
|
-
def initialize(server_response)
|
80
|
-
@error = server_response['error']
|
81
|
-
@ressources = server_response['ressources']
|
82
|
-
|
83
|
-
@status = if server_response['status'] == 'failure'
|
84
|
-
RequestStatus::FAILURE
|
85
|
-
elsif server_response['status'] == 'success'
|
86
|
-
RequestStatus::SUCCESS
|
87
|
-
else
|
88
|
-
server_response['status']&.to_sym
|
89
|
-
end
|
90
|
-
@status_code = server_response['status_code']
|
91
|
-
@url = server_response['url']
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
25
|
# Wrapper class for all predictions (synchronous and asynchronous)
|
96
26
|
class ApiResponse
|
97
27
|
# @return [Mindee::Parsing::Common::Document, nil]
|
@@ -107,8 +37,9 @@ module Mindee
|
|
107
37
|
# @param http_response [Hash]
|
108
38
|
# @param raw_http [String]
|
109
39
|
def initialize(product_class, http_response, raw_http)
|
40
|
+
logger.debug('Handling API response')
|
110
41
|
@raw_http = raw_http.to_s
|
111
|
-
raise 'Invalid response format.' unless http_response.key?('api_request')
|
42
|
+
raise Errors::MindeeAPIError, 'Invalid response format.' unless http_response.key?('api_request')
|
112
43
|
|
113
44
|
@api_request = Mindee::Parsing::Common::ApiRequest.new(http_response['api_request'])
|
114
45
|
|
@@ -121,27 +52,6 @@ module Mindee
|
|
121
52
|
@job = Mindee::Parsing::Common::Job.new(http_response['job']) if http_response.key?('job')
|
122
53
|
end
|
123
54
|
end
|
124
|
-
|
125
|
-
# Represents the server response after a document is sent to a workflow.
|
126
|
-
class WorkflowResponse
|
127
|
-
# Set the prediction model used to parse the document.
|
128
|
-
# The response object will be instantiated based on this parameter.
|
129
|
-
# @return [Mindee::Parsing::Common::Execution]
|
130
|
-
attr_reader :execution
|
131
|
-
# @return [Mindee::Parsing::Common::ApiRequest]
|
132
|
-
attr_reader :api_request
|
133
|
-
# @return [String]
|
134
|
-
attr_reader :raw_http
|
135
|
-
|
136
|
-
# @param http_response [Hash]
|
137
|
-
# @param product_class [Mindee::Inference]
|
138
|
-
def initialize(product_class, http_response, raw_http)
|
139
|
-
@raw_http = raw_http.to_s
|
140
|
-
@api_request = Mindee::Parsing::Common::ApiRequest.new(http_response['api_request'])
|
141
|
-
product_class = (product_class || Product::Generated::GeneratedV1)
|
142
|
-
@execution = Mindee::Parsing::Common::Execution.new(product_class, http_response['execution'])
|
143
|
-
end
|
144
|
-
end
|
145
55
|
end
|
146
56
|
end
|
147
57
|
end
|
@@ -16,25 +16,29 @@ module Mindee
|
|
16
16
|
attr_reader :id
|
17
17
|
# @return [Mindee::Parsing::Common::Extras::Extras] Potential Extras fields sent back along the prediction.
|
18
18
|
attr_reader :extras
|
19
|
-
# @return [Mindee::Parsing::Common::
|
19
|
+
# @return [Mindee::Parsing::Common::OCR::OCR, nil] OCR text results (limited availability)
|
20
20
|
attr_reader :ocr
|
21
21
|
# @return [Integer] Amount of pages of the document
|
22
22
|
attr_reader :n_pages
|
23
23
|
|
24
|
-
#
|
25
|
-
# @
|
24
|
+
# Loads the MVision OCR response.
|
25
|
+
# @param http_response [Hash] Full HTTP contents of the response.
|
26
|
+
# @return [Mindee::Parsing::Common::OCR::OCR]
|
26
27
|
def self.load_ocr(http_response)
|
27
28
|
ocr_prediction = http_response.fetch('ocr', nil)
|
28
29
|
return nil if ocr_prediction.nil? || ocr_prediction.fetch('mvision-v1', nil).nil?
|
29
30
|
|
30
|
-
|
31
|
+
OCR::OCR.new(ocr_prediction)
|
31
32
|
end
|
32
33
|
|
33
|
-
|
34
|
+
# Loads extras into the document prediction.
|
35
|
+
# @param http_response [Hash] Full HTTP contents of the response.
|
36
|
+
# @return [Mindee::Parsing::Common::OCR::OCR]
|
37
|
+
def self.extract_extras(http_response)
|
34
38
|
extras_prediction = http_response['inference'].fetch('extras', nil)
|
35
39
|
return nil if extras_prediction.nil? || extras_prediction.fetch('mvision-v1', nil).nil?
|
36
40
|
|
37
|
-
|
41
|
+
Mindee::Parsing::Common::Extras::Extras.new(extras_prediction)
|
38
42
|
end
|
39
43
|
|
40
44
|
# @param product_class [Mindee::Inference]
|
@@ -44,7 +48,7 @@ module Mindee
|
|
44
48
|
@name = http_response['name']
|
45
49
|
@inference = product_class.new(http_response['inference'])
|
46
50
|
@ocr = self.class.load_ocr(http_response)
|
47
|
-
@extras = self.class.
|
51
|
+
@extras = self.class.extract_extras(http_response)
|
48
52
|
inject_full_text_ocr(http_response)
|
49
53
|
@n_pages = http_response['n_pages']
|
50
54
|
end
|
@@ -69,7 +73,7 @@ module Mindee
|
|
69
73
|
end
|
70
74
|
artificial_text_obj = { 'content' => full_text_ocr }
|
71
75
|
if @extras.nil? || @extras.empty?
|
72
|
-
@extras = Extras::Extras.new({ 'full_text_ocr' => artificial_text_obj })
|
76
|
+
@extras = Mindee::Parsing::Common::Extras::Extras.new({ 'full_text_ocr' => artificial_text_obj })
|
73
77
|
else
|
74
78
|
@extras.add_artificial_extra({ 'full_text_ocr' => artificial_text_obj })
|
75
79
|
end
|
@@ -30,7 +30,7 @@ module Mindee
|
|
30
30
|
# @return [Time, nil]
|
31
31
|
attr_reader :available_at
|
32
32
|
# Reviewed fields and values.
|
33
|
-
# @return [Mindee::Product::
|
33
|
+
# @return [Mindee::Product::Universal::UniversalDocument]
|
34
34
|
attr_reader :reviewed_prediction
|
35
35
|
# Execution Status.
|
36
36
|
# @return [String]
|
@@ -59,7 +59,9 @@ module Mindee
|
|
59
59
|
@reviewed_at = Time.iso8601(http_response['reviewed_at']) if http_response['reviewed_at']
|
60
60
|
@available_at = Time.iso8601(http_response['available_at']) if http_response['available_at']
|
61
61
|
if http_response['reviewed_prediction']
|
62
|
-
@reviewed_prediction =
|
62
|
+
@reviewed_prediction = Mindee::Product::Universal::UniversalDocument.new(
|
63
|
+
http_response['reviewed_prediction']
|
64
|
+
)
|
63
65
|
end
|
64
66
|
@status = http_response['status']
|
65
67
|
@type = http_response['type']
|
@@ -5,8 +5,14 @@ module Mindee
|
|
5
5
|
module Common
|
6
6
|
# Execution policy priority values.
|
7
7
|
module ExecutionPriority
|
8
|
+
# Low priority execution.
|
9
|
+
# @return [Symbol] :low
|
8
10
|
LOW = :low
|
11
|
+
# Medium priority execution.
|
12
|
+
# @return [Symbol] :low
|
9
13
|
MEDIUM = :medium
|
14
|
+
# High priority execution.
|
15
|
+
# @return [Symbol] :low
|
10
16
|
HIGH = :high
|
11
17
|
|
12
18
|
# Sets the priority to one of its possibly values, defaults to nil otherwise.
|
@@ -13,12 +13,13 @@ module Mindee
|
|
13
13
|
attr_reader :croppings
|
14
14
|
|
15
15
|
def initialize(raw_prediction, page_id = nil)
|
16
|
-
@croppings = []
|
16
|
+
@croppings = [] # : Array[Mindee::Parsing::Standard::PositionField]
|
17
17
|
raw_prediction['cropping']&.each do |crop|
|
18
18
|
@croppings.push(Mindee::Parsing::Standard::PositionField.new(crop, page_id))
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
# @return [String]
|
22
23
|
def to_s
|
23
24
|
@croppings.map(&:to_s).join("\n ")
|
24
25
|
end
|
@@ -11,18 +11,23 @@ module Mindee
|
|
11
11
|
class Extras
|
12
12
|
# @return [CropperExtra, nil]
|
13
13
|
attr_reader :cropper
|
14
|
-
# @return [FullTextOCRExtra, nil]
|
14
|
+
# @return [Mindee::Parsing::Common::Extras::FullTextOCRExtra, nil]
|
15
15
|
attr_reader :full_text_ocr
|
16
16
|
|
17
17
|
def initialize(raw_prediction)
|
18
|
-
|
19
|
-
|
18
|
+
if raw_prediction['cropper']
|
19
|
+
@cropper = Mindee::Parsing::Common::Extras::CropperExtra.new(raw_prediction['cropper'])
|
20
|
+
end
|
21
|
+
if raw_prediction['full_text_ocr']
|
22
|
+
@full_text_ocr = Mindee::Parsing::Common::Extras::FullTextOCRExtra.new(raw_prediction['full_text_ocr'])
|
23
|
+
end
|
20
24
|
|
21
25
|
raw_prediction.each do |key, value|
|
22
26
|
instance_variable_set("@#{key}", value) unless ['cropper', 'full_text_ocr'].include?(key)
|
23
27
|
end
|
24
28
|
end
|
25
29
|
|
30
|
+
# @return [String]
|
26
31
|
def to_s
|
27
32
|
out_str = String.new
|
28
33
|
instance_variables.each do |var|
|
@@ -37,7 +42,7 @@ module Mindee
|
|
37
42
|
def add_artificial_extra(raw_prediction)
|
38
43
|
return unless raw_prediction['full_text_ocr']
|
39
44
|
|
40
|
-
@full_text_ocr << FullTextOCRExtra.new(raw_prediction)
|
45
|
+
@full_text_ocr << Mindee::Parsing::Common::Extras::FullTextOCRExtra.new(raw_prediction)
|
41
46
|
end
|
42
47
|
end
|
43
48
|
|
@@ -9,7 +9,7 @@ module Mindee
|
|
9
9
|
# Abstract class for prediction Inferences
|
10
10
|
# Holds prediction for a page or entire document.
|
11
11
|
class Inference
|
12
|
-
# @return [
|
12
|
+
# @return [bool]
|
13
13
|
attr_reader :is_rotation_applied
|
14
14
|
# @return [Array<Mindee::Parsing::Common::Page>]
|
15
15
|
attr_reader :pages
|
@@ -17,12 +17,29 @@ module Mindee
|
|
17
17
|
attr_reader :prediction
|
18
18
|
# @return [Mindee::Parsing::Common::Product]
|
19
19
|
attr_reader :product
|
20
|
+
# Name of the endpoint for this product.
|
21
|
+
# @return [String]
|
22
|
+
attr_reader :endpoint_name
|
23
|
+
# Version for this product.
|
24
|
+
# @return [String]
|
25
|
+
attr_reader :endpoint_version
|
26
|
+
# Whether this product has access to an asynchronous endpoint.
|
27
|
+
# @return [bool]
|
28
|
+
attr_reader :has_async
|
29
|
+
# Whether this product has access to synchronous endpoint.
|
30
|
+
# @return [bool]
|
31
|
+
attr_reader :has_sync
|
32
|
+
|
33
|
+
@endpoint_name = nil
|
34
|
+
@endpoint_version = nil
|
35
|
+
@has_async = false
|
36
|
+
@has_sync = false
|
20
37
|
|
21
38
|
# @param raw_prediction [Hash]
|
22
39
|
def initialize(raw_prediction)
|
23
40
|
@is_rotation_applied = raw_prediction['is_rotation_applied']
|
24
41
|
@product = Product.new(raw_prediction['product'])
|
25
|
-
@pages = []
|
42
|
+
@pages = [] # : Array[Page]
|
26
43
|
end
|
27
44
|
|
28
45
|
# @return [String]
|
@@ -34,8 +51,10 @@ module Mindee
|
|
34
51
|
out_str << "\n:Rotation applied: #{is_rotation_applied}"
|
35
52
|
out_str << "\n\nPrediction\n=========="
|
36
53
|
out_str << "\n#{@prediction.to_s.size.positive? ? "#{@prediction}\n" : ''}"
|
37
|
-
|
38
|
-
|
54
|
+
if @pages.any? { |page| !page.prediction.nil? }
|
55
|
+
out_str << "\nPage Predictions\n================\n\n"
|
56
|
+
out_str << @pages.map(&:to_s).join("\n\n")
|
57
|
+
end
|
39
58
|
out_str.rstrip!
|
40
59
|
out_str
|
41
60
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'time'
|
4
|
+
|
5
|
+
module Mindee
|
6
|
+
module Parsing
|
7
|
+
module Common
|
8
|
+
# Job (queue) information on async parsing.
|
9
|
+
class Job
|
10
|
+
# @return [String] Mindee ID of the document
|
11
|
+
attr_reader :id
|
12
|
+
# @return [Time]
|
13
|
+
attr_reader :issued_at
|
14
|
+
# @return [Time, nil]
|
15
|
+
attr_reader :available_at
|
16
|
+
# @return [JobStatus, Symbol]
|
17
|
+
attr_reader :status
|
18
|
+
# @return [Integer, nil]
|
19
|
+
attr_reader :millisecs_taken
|
20
|
+
# @return [Hash, nil]
|
21
|
+
attr_reader :error
|
22
|
+
|
23
|
+
# @param http_response [Hash]
|
24
|
+
def initialize(http_response)
|
25
|
+
@id = http_response['id']
|
26
|
+
@error = http_response['error']
|
27
|
+
@issued_at = Time.iso8601(http_response['issued_at'])
|
28
|
+
if http_response.key?('available_at') && !http_response['available_at'].nil?
|
29
|
+
@available_at = Time.iso8601(http_response['available_at'])
|
30
|
+
@millisecs_taken = (1000 * (@available_at.to_time - @issued_at.to_time).to_f).to_i
|
31
|
+
end
|
32
|
+
@status = case http_response['status']
|
33
|
+
when 'waiting'
|
34
|
+
JobStatus::WAITING
|
35
|
+
when 'processing'
|
36
|
+
JobStatus::PROCESSING
|
37
|
+
when 'completed'
|
38
|
+
JobStatus::COMPLETED
|
39
|
+
else
|
40
|
+
http_response['status']&.to_sym
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -3,18 +3,18 @@
|
|
3
3
|
module Mindee
|
4
4
|
module Parsing
|
5
5
|
module Common
|
6
|
-
module
|
6
|
+
module OCR
|
7
7
|
# Mindee Vision V1.
|
8
8
|
class MVisionV1
|
9
9
|
# List of pages.
|
10
|
-
# @return [Array<
|
10
|
+
# @return [Array<OCRPage>]
|
11
11
|
attr_reader :pages
|
12
12
|
|
13
13
|
# @param prediction [Hash]
|
14
14
|
def initialize(prediction)
|
15
|
-
@pages = []
|
15
|
+
@pages = [] # : Array[Mindee::Parsing::Common::OCR::OCRPage]
|
16
16
|
prediction['pages'].each do |page_prediction|
|
17
|
-
@pages.push(
|
17
|
+
@pages.push(OCRPage.new(page_prediction))
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -33,9 +33,9 @@ module Mindee
|
|
33
33
|
# start.
|
34
34
|
# @param page_id [Integer] ID of the page to start at
|
35
35
|
# @param x_margin [Float] Margin of misalignment for the x coordinate.
|
36
|
-
# @return [Mindee::Parsing::Common::
|
36
|
+
# @return [Mindee::Parsing::Common::OCR::OCRLine]
|
37
37
|
def reconstruct_vertically(coordinates, page_id, x_margin)
|
38
|
-
line_arr =
|
38
|
+
line_arr = OCRLine.new([])
|
39
39
|
@pages[page_id].all_lines.each do |line|
|
40
40
|
line.each do |word|
|
41
41
|
line_arr.push(word) if Geometry.below?(word.polygon, coordinates, x_margin / 2, x_margin * 2)
|
@@ -6,9 +6,9 @@ module Mindee
|
|
6
6
|
module Parsing
|
7
7
|
module Common
|
8
8
|
# Ocr-specific parsing fields and options
|
9
|
-
module
|
9
|
+
module OCR
|
10
10
|
# A single word.
|
11
|
-
class
|
11
|
+
class OCRWord
|
12
12
|
# The confidence score, value will be between 0.0 and 1.0
|
13
13
|
# @return [Float]
|
14
14
|
attr_accessor :confidence
|
@@ -34,24 +34,24 @@ module Mindee
|
|
34
34
|
end
|
35
35
|
|
36
36
|
# A list of words which are on the same line.
|
37
|
-
class
|
37
|
+
class OCRLine < Array
|
38
38
|
# @param prediction [Hash, nil]
|
39
39
|
# @param from_array [Array, nil]
|
40
40
|
def initialize(prediction = nil, from_array = nil)
|
41
41
|
if !prediction.nil?
|
42
|
-
super(prediction.map { |word_prediction|
|
42
|
+
super(prediction.map { |word_prediction| OCRWord.new(word_prediction) })
|
43
43
|
elsif !from_array.nil?
|
44
44
|
super(from_array)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
# Sort the words on the line from left to right.
|
49
|
-
# @return [
|
49
|
+
# @return [OCRLine]
|
50
50
|
def sort_on_x
|
51
51
|
from_array = sort do |word1, word2|
|
52
52
|
Geometry.get_min_max_x(word1.polygon).min <=> Geometry.get_min_max_x(word2.polygon).min
|
53
53
|
end
|
54
|
-
|
54
|
+
OCRLine.new(nil, from_array)
|
55
55
|
end
|
56
56
|
|
57
57
|
# @return [String]
|
@@ -61,24 +61,24 @@ module Mindee
|
|
61
61
|
end
|
62
62
|
|
63
63
|
# OCR extraction for a single page.
|
64
|
-
class
|
64
|
+
class OCRPage
|
65
65
|
# All the words on the page, in semi-random order.
|
66
|
-
# @return [Array<
|
66
|
+
# @return [Array<OCRWord>]
|
67
67
|
attr_reader :all_words
|
68
|
-
# @return [Array<
|
68
|
+
# @return [Array<OCRLine>]
|
69
69
|
attr_reader :lines
|
70
70
|
|
71
71
|
# @param prediction [Hash]
|
72
72
|
def initialize(prediction)
|
73
|
-
@lines = []
|
74
|
-
@all_words = []
|
73
|
+
@lines = [] # : Array[Mindee::Parsing::Common::OCR::OCRLine]
|
74
|
+
@all_words = [] # : Array[Mindee::Parsing::Common::OCR::OCRWord]
|
75
75
|
prediction['all_words'].each do |word_prediction|
|
76
|
-
@all_words.push(
|
76
|
+
@all_words.push(OCRWord.new(word_prediction))
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
80
|
# All the words on the page, ordered in lines.
|
81
|
-
# @return [Array<
|
81
|
+
# @return [Array<OCRLine>]
|
82
82
|
def all_lines
|
83
83
|
@lines = to_lines if @lines.empty?
|
84
84
|
@lines
|
@@ -99,19 +99,19 @@ module Mindee
|
|
99
99
|
private
|
100
100
|
|
101
101
|
# Helper function that iterates through all the words and compares them to a candidate
|
102
|
-
# @param sorted_words [Array<
|
103
|
-
# @param current [
|
102
|
+
# @param sorted_words [Array<OCRWord>]
|
103
|
+
# @param current [OCRWord]
|
104
104
|
# @param indexes [Array<Integer>]
|
105
|
-
# @param lines [Array<
|
105
|
+
# @param lines [Array<OCRLine>]
|
106
106
|
def parse_one(sorted_words, current, indexes, lines)
|
107
|
-
line =
|
107
|
+
line = OCRLine.new([])
|
108
108
|
sorted_words.each_with_index do |word, idx|
|
109
109
|
next if indexes.include?(idx)
|
110
110
|
|
111
111
|
if current.nil?
|
112
112
|
current = word
|
113
113
|
indexes.push(idx)
|
114
|
-
line =
|
114
|
+
line = OCRLine.new([])
|
115
115
|
line.push(word)
|
116
116
|
elsif words_on_same_line?(current, word)
|
117
117
|
line.push(word)
|
@@ -122,11 +122,11 @@ module Mindee
|
|
122
122
|
end
|
123
123
|
|
124
124
|
# Order all the words on the page into lines.
|
125
|
-
# @return [Array<
|
125
|
+
# @return [Array<OCRLine>]
|
126
126
|
def to_lines
|
127
127
|
current = nil
|
128
|
-
indexes = []
|
129
|
-
lines = []
|
128
|
+
indexes = [] # : Array[Integer]
|
129
|
+
lines = [] # : Array[Mindee::Parsing::Common::OCR::OCRLine]
|
130
130
|
|
131
131
|
# make sure words are sorted from top to bottom
|
132
132
|
all_words = @all_words.sort_by { |word| Geometry.get_min_max_y(word.polygon).min }
|
@@ -138,25 +138,25 @@ module Mindee
|
|
138
138
|
end
|
139
139
|
|
140
140
|
# Determine if two words are on the same line.
|
141
|
-
# @param current_word [Mindee::Parsing::Common::
|
142
|
-
# @param next_word [Mindee::Parsing::Common::
|
143
|
-
# @return [
|
141
|
+
# @param current_word [Mindee::Parsing::Common::OCR::OCRWord]
|
142
|
+
# @param next_word [Mindee::Parsing::Common::OCR::OCRWord]
|
143
|
+
# @return [bool]
|
144
144
|
def words_on_same_line?(current_word, next_word)
|
145
145
|
current_in_next = current_word.polygon.point_in_y?(next_word.polygon.centroid)
|
146
|
-
next_in_current = next_word.polygon.point_in_y?(current_word.polygon.centroid)
|
146
|
+
next_in_current = next_word.polygon.point_in_y?(current_word.polygon.centroid) unless current_word.nil?
|
147
147
|
current_in_next || next_in_current
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
151
|
# OCR extraction from the entire document.
|
152
|
-
class
|
152
|
+
class OCR
|
153
153
|
# Mindee Vision v1 results.
|
154
|
-
# @return [Mindee::Parsing::Common::
|
154
|
+
# @return [Mindee::Parsing::Common::OCR::MVisionV1]
|
155
155
|
attr_reader :mvision_v1
|
156
156
|
|
157
157
|
# @param prediction [Hash]
|
158
158
|
def initialize(prediction)
|
159
|
-
@mvision_v1 = MVisionV1.new(prediction['mvision-v1'])
|
159
|
+
@mvision_v1 = Mindee::Parsing::Common::OCR::MVisionV1.new(prediction['mvision-v1'])
|
160
160
|
end
|
161
161
|
|
162
162
|
# @return [String]
|
@@ -169,7 +169,7 @@ module Mindee
|
|
169
169
|
# start
|
170
170
|
# @param page_id [Integer] ID of the page to start at
|
171
171
|
# @param x_margin [Float] Margin of misalignment for the x coordinate (default 10%)
|
172
|
-
# @return [Mindee::Parsing::Common::
|
172
|
+
# @return [Mindee::Parsing::Common::OCR::OCRLine]
|
173
173
|
def reconstruct_vertically(coordinates, page_id, x_margin = 0.05)
|
174
174
|
@mvision_v1.reconstruct_vertically(coordinates, page_id, x_margin)
|
175
175
|
end
|
@@ -10,7 +10,7 @@ module Mindee
|
|
10
10
|
# Abstract wrapper class for prediction Pages
|
11
11
|
# Holds prediction for a page as well as it's orientation and id.
|
12
12
|
class Page
|
13
|
-
#
|
13
|
+
# ID of the page (as given by the API).
|
14
14
|
# @return [Integer]
|
15
15
|
attr_reader :page_id
|
16
16
|
# Orientation of the page.
|
@@ -26,8 +26,10 @@ module Mindee
|
|
26
26
|
# @param raw_prediction [Hash]
|
27
27
|
def initialize(raw_prediction)
|
28
28
|
@page_id = raw_prediction['id']
|
29
|
-
@orientation = Orientation.new(raw_prediction['orientation'], @page_id)
|
30
|
-
|
29
|
+
@orientation = Mindee::Parsing::Common::Orientation.new(raw_prediction['orientation'], @page_id)
|
30
|
+
return if raw_prediction['extras'].nil?
|
31
|
+
|
32
|
+
@extras = Mindee::Parsing::Common::Extras::Extras.new(raw_prediction['extras'])
|
31
33
|
end
|
32
34
|
|
33
35
|
# @return [String]
|