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
@@ -1,338 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'ocr_extractor'
|
4
|
-
|
5
|
-
# rubocop:disable Metrics/ClassLength
|
6
|
-
|
7
|
-
module Mindee
|
8
|
-
module Extraction
|
9
|
-
# Tax extractor class
|
10
|
-
class TaxExtractor < OcrExtractor
|
11
|
-
# Extracts the most relevant candidate.
|
12
|
-
# @param candidates [Array<Hash>] a candidate for the tax.
|
13
|
-
# @param tax_names [Array<String>] list of all possible names the tax can have.
|
14
|
-
# @return [Hash, nil]
|
15
|
-
def self.pick_best(candidates, tax_names)
|
16
|
-
return candidates[0] if candidates.size == 1
|
17
|
-
return nil if candidates.empty?
|
18
|
-
|
19
|
-
picked = 0
|
20
|
-
picked_score = 0
|
21
|
-
|
22
|
-
candidates.each_with_index do |candidate, i|
|
23
|
-
next unless valid_candidate?(candidate, tax_names)
|
24
|
-
|
25
|
-
sum_fields_score = calculate_score(candidate, i)
|
26
|
-
|
27
|
-
if picked_score < sum_fields_score
|
28
|
-
picked_score = sum_fields_score
|
29
|
-
picked = i
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
candidates[picked]
|
34
|
-
end
|
35
|
-
|
36
|
-
# Checks whether a tax code has been properly read. Shouldn't trigger except in case of very specific regex breaks
|
37
|
-
# due to unsupported diacritics.
|
38
|
-
# @param candidate [Hash] A candidate for the tax.
|
39
|
-
# @param tax_names [Array<String>] list of all possible names the tax can have.
|
40
|
-
# @return [Boolean]
|
41
|
-
def self.valid_candidate?(candidate, tax_names)
|
42
|
-
return false if tax_names.empty? || candidate.nil? || candidate['code'].nil?
|
43
|
-
|
44
|
-
tax_names.each do |tax_name|
|
45
|
-
return true if remove_accents(tax_name.downcase) == remove_accents(candidate['code'].downcase)
|
46
|
-
end
|
47
|
-
false
|
48
|
-
end
|
49
|
-
|
50
|
-
# [Experimental] computes the score of a valid candidate for a tax.
|
51
|
-
# @param candidate [Hash] A candidate for the tax.
|
52
|
-
# @param index [Integer]
|
53
|
-
def self.calculate_score(candidate, index)
|
54
|
-
score = index + 1
|
55
|
-
unless candidate['rate'].nil?
|
56
|
-
score += 1
|
57
|
-
score -= 2 if candidate['rate'] > 100
|
58
|
-
score -= 1 if candidate['rate'] > 30
|
59
|
-
end
|
60
|
-
score += 4 unless candidate['value'].nil?
|
61
|
-
score += 1 unless candidate['base'].nil?
|
62
|
-
score
|
63
|
-
end
|
64
|
-
|
65
|
-
# Curates tax values based on simple rules to avoid improbable data
|
66
|
-
# @param found_hash [Hash] Hash of currently retrieved values
|
67
|
-
# @param min_rate_percentage [Integer] Minimum allowed rate on the tax.
|
68
|
-
# @param max_rate_percentage [Integer] Maximum allowed rate on the tax.
|
69
|
-
# @return [Hash]
|
70
|
-
def self.curate_values(found_hash, min_rate_percentage, max_rate_percentage)
|
71
|
-
reconstructed_hash = { 'code' => nil, 'page_id' => nil, 'rate' => nil, 'base' => nil, 'value' => nil }
|
72
|
-
return reconstructed_hash if found_hash.nil?
|
73
|
-
|
74
|
-
reconstructed_hash['code'] =
|
75
|
-
found_hash['code'].nil? ? found_hash['code'] : found_hash['code'].sub(%r{\s*\.*\s*$}, '')
|
76
|
-
|
77
|
-
if found_hash['rate']
|
78
|
-
if found_hash['rate'].abs < 1
|
79
|
-
found_hash['rate'] *= 10
|
80
|
-
elsif found_hash['rate'].abs > 100
|
81
|
-
found_hash['rate'] /= 10
|
82
|
-
end
|
83
|
-
end
|
84
|
-
found_hash = swap_rates_if_needed(found_hash, min_rate_percentage, max_rate_percentage)
|
85
|
-
found_hash = decimate_rates_if_needed(found_hash)
|
86
|
-
found_hash = fix_rate(found_hash)
|
87
|
-
reconstructed_hash['rate'] = found_hash['rate']
|
88
|
-
set_base_and_value(reconstructed_hash, found_hash)
|
89
|
-
end
|
90
|
-
|
91
|
-
# Swaps the rate with base or value if rate is out of bounds
|
92
|
-
# @param found_hash [Hash] Hash of currently retrieved values
|
93
|
-
# @param min_rate_percentage [Integer] Minimum allowed rate on the tax.
|
94
|
-
# @param max_rate_percentage [Integer] Maximum allowed rate on the tax.
|
95
|
-
# @return [Hash]
|
96
|
-
def self.swap_rates_if_needed(found_hash, min_rate_percentage, max_rate_percentage)
|
97
|
-
if found_hash['rate'] && (found_hash['rate'] > max_rate_percentage || found_hash['rate'] < min_rate_percentage)
|
98
|
-
if valid_percentage?(found_hash['base'], min_rate_percentage, max_rate_percentage)
|
99
|
-
found_hash['rate'], found_hash['base'] = found_hash['base'], found_hash['rate']
|
100
|
-
elsif valid_percentage?(found_hash['value'], min_rate_percentage, max_rate_percentage)
|
101
|
-
found_hash['rate'], found_hash['value'] = found_hash['value'], found_hash['rate']
|
102
|
-
end
|
103
|
-
end
|
104
|
-
found_hash
|
105
|
-
end
|
106
|
-
|
107
|
-
# Rates can't be negative if set.
|
108
|
-
# @param found_hash [Hash] Hash of currently retrieved values
|
109
|
-
def self.fix_rate(found_hash)
|
110
|
-
found_hash['rate'] = found_hash['rate'].abs unless found_hash['rate'].nil?
|
111
|
-
found_hash
|
112
|
-
end
|
113
|
-
|
114
|
-
# Swaps the rate with base or value if rate is out of bounds
|
115
|
-
# @param found_hash [Hash] Hash of currently retrieved values
|
116
|
-
# @return [Hash]
|
117
|
-
def self.decimate_rates_if_needed(found_hash)
|
118
|
-
if found_hash['rate'] && found_hash['rate'] > 100
|
119
|
-
if !found_hash['base'].nil? && found_hash['rate'] > found_hash['base']
|
120
|
-
found_hash['rate'], found_hash['base'] = found_hash['base'], found_hash['rate']
|
121
|
-
elsif !found_hash['value'].nil? && found_hash['rate'] > found_hash['value']
|
122
|
-
found_hash['rate'], found_hash['value'] = found_hash['value'], found_hash['rate']
|
123
|
-
end
|
124
|
-
end
|
125
|
-
found_hash
|
126
|
-
end
|
127
|
-
|
128
|
-
# Sets the base and value in the reconstructed hash based on certain conditions
|
129
|
-
# @param reconstructed_hash [Hash] Hash being reconstructed with new values
|
130
|
-
# @param found_hash [Hash] Hash of currently retrieved values
|
131
|
-
# @return [Hash]
|
132
|
-
def self.set_base_and_value(reconstructed_hash, found_hash)
|
133
|
-
base = found_hash['base']
|
134
|
-
value = found_hash['value']
|
135
|
-
|
136
|
-
if base && value
|
137
|
-
reconstructed_hash['base'], reconstructed_hash['value'] = [base, value].minmax
|
138
|
-
elsif base
|
139
|
-
reconstructed_hash['base'] = base
|
140
|
-
elsif value
|
141
|
-
reconstructed_hash['value'] = value
|
142
|
-
calculate_base(reconstructed_hash)
|
143
|
-
end
|
144
|
-
|
145
|
-
reconstructed_hash
|
146
|
-
end
|
147
|
-
|
148
|
-
def self.calculate_base(hash)
|
149
|
-
rate = hash['rate']
|
150
|
-
return unless rate&.positive?
|
151
|
-
|
152
|
-
hash['base'] = hash['value'] / (rate / 100.0)
|
153
|
-
end
|
154
|
-
|
155
|
-
# Extracts a single custom type of tax.
|
156
|
-
# For the sake of simplicity, this only extracts the first example, unless specifically instructed otherwise.
|
157
|
-
# @param ocr_result [Mindee::Parsing::Common::Ocr::Ocr] result of the OCR.
|
158
|
-
# @param tax_names [Array<String>] list of all possible names the tax can have.
|
159
|
-
# @param min_rate_percentage [Integer] Minimum allowed rate on the tax.
|
160
|
-
# @param max_rate_percentage [Integer] Maximum allowed rate on the tax.
|
161
|
-
# @return [Mindee::Parsing::Standard::TaxField, nil]
|
162
|
-
def self.extract_custom_tax(ocr_result, tax_names, min_rate_percentage = 0, max_rate_percentage = 100)
|
163
|
-
return nil if ocr_result.is_a?(Mindee::Parsing::Common::Ocr) || tax_names.empty?
|
164
|
-
|
165
|
-
tax_names.sort!
|
166
|
-
found_hash = pick_best(extract_horizontal_tax(ocr_result, tax_names), tax_names)
|
167
|
-
if found_hash.nil? || found_hash['value'].nil?
|
168
|
-
found_hash = extract_vertical_tax(ocr_result, tax_names,
|
169
|
-
found_hash)
|
170
|
-
end
|
171
|
-
found_hash = curate_values(found_hash, min_rate_percentage, max_rate_percentage)
|
172
|
-
|
173
|
-
return if found_hash.nil? || found_hash.empty?
|
174
|
-
|
175
|
-
create_tax_field(found_hash)
|
176
|
-
end
|
177
|
-
|
178
|
-
# Creates a tax field from a given hash.
|
179
|
-
# @param found_hash [Hash] Hash of currently retrieved values
|
180
|
-
# @return [Mindee::Parsing::Standard::TaxField]
|
181
|
-
def self.create_tax_field(found_hash)
|
182
|
-
Mindee::Parsing::Standard::TaxField.new(
|
183
|
-
found_hash,
|
184
|
-
found_hash.key?('page_id') ? found_hash['page_id'] : nil
|
185
|
-
)
|
186
|
-
end
|
187
|
-
|
188
|
-
# Extracts the rate and code, if found, from matches into the found_hash.
|
189
|
-
# @param matches [MatchData] RegEx matches of the values for taxes
|
190
|
-
# @param found_hash [Hash] Hash of currently retrieved values
|
191
|
-
# @param percent_first [Boolean] Whether the percentage was found before or after the tax name.
|
192
|
-
# @return [Hash]
|
193
|
-
def self.extract_percentage_from_tax(matches, found_hash, percent_first)
|
194
|
-
if percent_first
|
195
|
-
found_hash['code'] = matches[2].strip unless matches[2].nil?
|
196
|
-
found_hash['rate'] = parse_amount(matches[1].gsub('%', '')) unless matches[1].nil?
|
197
|
-
else
|
198
|
-
found_hash['code'] = matches[1].strip unless matches[1].nil?
|
199
|
-
found_hash['rate'] = parse_amount(matches[2].gsub('%', '')) unless matches[2].nil?
|
200
|
-
end
|
201
|
-
found_hash
|
202
|
-
end
|
203
|
-
|
204
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
205
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
206
|
-
|
207
|
-
# Extracts the basis and value of a tax from regex matches, independent of the order.
|
208
|
-
# @param matches [MatchData] RegEx matches of the values for taxes
|
209
|
-
# @param found_hash [Hash] Hash of currently retrieved values
|
210
|
-
# @return [Hash]
|
211
|
-
def self.extract_basis_and_value(matches, found_hash)
|
212
|
-
if matches[4].nil? && !matches[3].nil?
|
213
|
-
found_hash['value'] = parse_amount(matches[3]) unless matches[3].nil?
|
214
|
-
elsif matches[3].nil? && !matches[4].nil?
|
215
|
-
found_hash['value'] = parse_amount(matches[4]) unless matches[4].nil?
|
216
|
-
elsif !matches[3].nil? && !matches[4].nil?
|
217
|
-
found_hash['base'] = parse_amount(matches[3]) unless matches[3].nil?
|
218
|
-
found_hash['value'] = parse_amount(matches[4]) unless matches[4].nil?
|
219
|
-
end
|
220
|
-
found_hash
|
221
|
-
end
|
222
|
-
|
223
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
224
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
225
|
-
|
226
|
-
# Extracts tax information from a horizontal line.
|
227
|
-
# @param line [String] Line to be processed.
|
228
|
-
# @param pattern [Regexp] RegEx pattern to search the line with.
|
229
|
-
# @param percent_first [Boolean] Whether the percentage was found before or after the tax name.
|
230
|
-
# @return [Hash]
|
231
|
-
def self.extract_tax_from_horizontal_line(line, pattern, page_id, percent_first)
|
232
|
-
found_hash = {}
|
233
|
-
|
234
|
-
matches = line.match(pattern)
|
235
|
-
|
236
|
-
# Edge case for when the tax is split-up between two pages, we'll consider that
|
237
|
-
# the answer belongs to the first one.
|
238
|
-
found_hash['page_id'] = page_id unless found_hash.key?('page_id')
|
239
|
-
return found_hash if matches.nil?
|
240
|
-
|
241
|
-
found_hash = extract_percentage_from_tax(matches, found_hash, percent_first)
|
242
|
-
extract_basis_and_value(matches, found_hash)
|
243
|
-
end
|
244
|
-
|
245
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
246
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
247
|
-
|
248
|
-
# Processes a horizontal line for tax extraction. Returns a hash of collected values.
|
249
|
-
# @param ocr_result [Mindee::Parsing::Common::Ocr::Ocr] Processed OCR results.
|
250
|
-
# @param tax_names [Array<String>] Possible tax names candidates.
|
251
|
-
# @return [Array<Hash>]
|
252
|
-
def self.extract_horizontal_tax(ocr_result, tax_names)
|
253
|
-
candidates = [{ 'code' => nil, 'value' => nil, 'base' => nil, 'rate' => nil }]
|
254
|
-
linear_pattern_percent_first = %r{
|
255
|
-
((?:\s*-\s*)?(?:\d*[.,])*\d+[ ]?%?|%?[ ]?(?:\s*-\s*)?(?:\d*[.,])*\d+)?[ .]?
|
256
|
-
([a-zA-ZÀ-ÖØ-öø-ÿ .]*[a-zA-ZÀ-ÖØ-öø-ÿ]?)[ .]?
|
257
|
-
((?:\s*-\s*)?(?:\d*[.,])+\d+)?[ .]*
|
258
|
-
((?:\s*-\s*)?(\d*[.,])*\d+)?
|
259
|
-
}x
|
260
|
-
linear_pattern_percent_second = %r{
|
261
|
-
([a-zA-ZÀ-ÖØ-öø-ÿ .]*[a-zA-ZÀ-ÖØ-öø-ÿ]?)[ .]*
|
262
|
-
((?:\s*-\s*)?(?:\d*[.,])*\d+[ ]?%?|%?[ ]?(?:\s*-\s*)?(?:\d*[.,])*\d+)?[ .]?
|
263
|
-
((?:\s*-\s*)?(?:\d*[.,])+\d+)?[ .]*
|
264
|
-
((?:\s*-\s*)?(\d*[.,])*\d+)?
|
265
|
-
}x
|
266
|
-
ocr_result.mvision_v1.pages.each.with_index do |page, page_id|
|
267
|
-
page.all_lines.each do |line|
|
268
|
-
clean_line = remove_currency_symbols(line.to_s.scrub.gsub(%r{[+(\[)\]¿?*_]}, '')).gsub(%r{\.{2,}}, ' ')
|
269
|
-
.gsub(%r{ +}, ' ').strip
|
270
|
-
|
271
|
-
next if match_index(clean_line, tax_names).nil?
|
272
|
-
|
273
|
-
unless clean_line.match(linear_pattern_percent_second).nil?
|
274
|
-
candidates.append(extract_tax_from_horizontal_line(clean_line[match_index(clean_line, tax_names)..],
|
275
|
-
linear_pattern_percent_second, page_id, false))
|
276
|
-
end
|
277
|
-
if clean_line.include?('%') && !clean_line.match(linear_pattern_percent_first).nil?
|
278
|
-
candidates.append(extract_tax_from_horizontal_line(clean_line[clean_line.index(%r{\d*[.,]?\d* ?%})..],
|
279
|
-
linear_pattern_percent_first, page_id, true))
|
280
|
-
elsif !clean_line.match(linear_pattern_percent_first).nil?
|
281
|
-
candidates.append(extract_tax_from_horizontal_line(clean_line,
|
282
|
-
linear_pattern_percent_first, page_id, true))
|
283
|
-
end
|
284
|
-
end
|
285
|
-
end
|
286
|
-
candidates
|
287
|
-
end
|
288
|
-
|
289
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
290
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
291
|
-
|
292
|
-
# Processes a vertical reconstructed line for tax extraction. Returns a hash of collected values.
|
293
|
-
# @param line [Mindee::Parsing::Common::Ocr::OcrLine] Processed OCR results.
|
294
|
-
# @param found_hash [Hash] Hash containing previously found values, if any.
|
295
|
-
# @return [Hash]
|
296
|
-
def self.extract_vertical_tax_values(line, found_hash)
|
297
|
-
amounts = []
|
298
|
-
line.each do |reconstructed_word|
|
299
|
-
amounts.push(parse_amount(reconstructed_word.text)) unless parse_amount(reconstructed_word.text).nil?
|
300
|
-
end
|
301
|
-
if amounts.length == 1 && !found_hash.key?('value')
|
302
|
-
found_hash['value'] = amounts[0]
|
303
|
-
else
|
304
|
-
found_hash['rate'] = amounts[0] if found_hash['rate'].nil?
|
305
|
-
found_hash['value'] = amounts[1] if found_hash['value'].nil?
|
306
|
-
end
|
307
|
-
found_hash
|
308
|
-
end
|
309
|
-
|
310
|
-
# Extracts tax data from a vertical reconstructed row.
|
311
|
-
# @param ocr_result [Mindee::Parsing::Common::Ocr] OCR raw results
|
312
|
-
# @param tax_names [Array<String>] Array of possible names a tax can have
|
313
|
-
# @param found_hash [Hash] Hash of currently retrieved values
|
314
|
-
def self.extract_vertical_tax(ocr_result, tax_names, found_hash)
|
315
|
-
found_hash = { 'code' => nil, 'page_id' => nil } if found_hash.nil?
|
316
|
-
|
317
|
-
ocr_result.mvision_v1.pages.each_with_index do |page, page_id|
|
318
|
-
page.all_words.each do |word|
|
319
|
-
next if match_index(word.text, tax_names).nil?
|
320
|
-
|
321
|
-
reconstructed_line = ocr_result.reconstruct_vertically(word.polygon, page_id, 0.25)
|
322
|
-
found_hash['page_id'] = page_id if found_hash['page_id'].nil?
|
323
|
-
found_hash['code'] = word.text.strip if found_hash['code'].nil?
|
324
|
-
found_hash = extract_vertical_tax_values(reconstructed_line, found_hash)
|
325
|
-
end
|
326
|
-
end
|
327
|
-
found_hash
|
328
|
-
end
|
329
|
-
|
330
|
-
private_class_method :extract_percentage_from_tax, :extract_basis_and_value, :extract_tax_from_horizontal_line,
|
331
|
-
:extract_horizontal_tax, :extract_vertical_tax_values, :extract_vertical_tax,
|
332
|
-
:create_tax_field, :fix_rate, :pick_best, :calculate_score, :curate_values,
|
333
|
-
:decimate_rates_if_needed, :set_base_and_value, :valid_candidate?,
|
334
|
-
:swap_rates_if_needed, :calculate_base
|
335
|
-
end
|
336
|
-
end
|
337
|
-
end
|
338
|
-
# rubocop:enable Metrics/ClassLength
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Mindee
|
4
|
-
module Parsing
|
5
|
-
module Custom
|
6
|
-
# Document classification (custom docs)
|
7
|
-
class ClassificationField
|
8
|
-
# The classification value
|
9
|
-
# @return [String]
|
10
|
-
attr_reader :value
|
11
|
-
# The confidence score, value will be between 0.0 and 1.0
|
12
|
-
# @return [Float]
|
13
|
-
attr_accessor :confidence
|
14
|
-
|
15
|
-
# @param prediction [Hash]
|
16
|
-
def initialize(prediction)
|
17
|
-
@value = prediction['value']
|
18
|
-
@confidence = prediction['confidence']
|
19
|
-
end
|
20
|
-
|
21
|
-
# @return [String]
|
22
|
-
def to_s
|
23
|
-
@value.nil? ? '' : @value
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,78 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Mindee
|
4
|
-
module Parsing
|
5
|
-
module Custom
|
6
|
-
# Field in a list.
|
7
|
-
class ListFieldItem
|
8
|
-
# The confidence score, value will be between 0.0 and 1.0
|
9
|
-
# @return [Float]
|
10
|
-
attr_accessor :confidence
|
11
|
-
# @return [Mindee::Geometry::Quadrilateral]
|
12
|
-
attr_reader :bounding_box
|
13
|
-
# @return [Mindee::Geometry::Polygon]
|
14
|
-
attr_reader :polygon
|
15
|
-
# @return [Array, Hash, String, nil]
|
16
|
-
attr_reader :content
|
17
|
-
# @return [Integer, nil]
|
18
|
-
attr_reader :page_id
|
19
|
-
|
20
|
-
# @param prediction [Hash]
|
21
|
-
def initialize(prediction, page_id: nil)
|
22
|
-
@content = prediction['content']
|
23
|
-
@confidence = prediction['confidence']
|
24
|
-
@polygon = Geometry.polygon_from_prediction(prediction['polygon'])
|
25
|
-
@bounding_box = Geometry.get_bounding_box(@polygon) unless @polygon.nil? || @polygon.empty?
|
26
|
-
@page_id = page_id
|
27
|
-
end
|
28
|
-
|
29
|
-
# @return [String]
|
30
|
-
def to_s
|
31
|
-
@content.to_s
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# Field where actual values are kept in a list (custom docs).
|
36
|
-
class ListField
|
37
|
-
# @return [Array<Mindee::Parsing::Custom::ListFieldItem>]
|
38
|
-
attr_reader :values
|
39
|
-
# true if the field was reconstructed or computed using other fields.
|
40
|
-
# @return [Boolean]
|
41
|
-
attr_reader :reconstructed
|
42
|
-
# The confidence score, value will be between 0.0 and 1.0
|
43
|
-
# @return [Float]
|
44
|
-
attr_accessor :confidence
|
45
|
-
|
46
|
-
# @param prediction [Hash]
|
47
|
-
# @param page_id [Integer, nil]
|
48
|
-
# @param reconstructed [Boolean]
|
49
|
-
def initialize(prediction, page_id, reconstructed: false)
|
50
|
-
@values = []
|
51
|
-
@confidence = prediction['confidence']
|
52
|
-
page_id = prediction['page_id'] if page_id.nil? && prediction.include?('page_id')
|
53
|
-
@reconstructed = reconstructed
|
54
|
-
|
55
|
-
prediction['values'].each do |field|
|
56
|
-
page_id = field['page_id'] if field.include?('page_id')
|
57
|
-
@values.push(ListFieldItem.new(field, page_id: page_id))
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
# @return [Array]
|
62
|
-
def contents_list
|
63
|
-
@values.map(&:content)
|
64
|
-
end
|
65
|
-
|
66
|
-
# @return [String]
|
67
|
-
def contents_str(separator: ' ')
|
68
|
-
@values.map(&:to_s).join(separator)
|
69
|
-
end
|
70
|
-
|
71
|
-
# @return [String]
|
72
|
-
def to_s
|
73
|
-
contents_str(separator: ' ')
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'custom_v1_document'
|
4
|
-
require_relative 'custom_v1_page'
|
5
|
-
|
6
|
-
module Mindee
|
7
|
-
module Product
|
8
|
-
# Custom product module.
|
9
|
-
module Custom
|
10
|
-
# Custom Document V1 prediction inference.
|
11
|
-
class CustomV1 < Mindee::Parsing::Common::Inference
|
12
|
-
@endpoint_name = ''
|
13
|
-
@endpoint_version = ''
|
14
|
-
|
15
|
-
# @param prediction [Hash]
|
16
|
-
def initialize(prediction)
|
17
|
-
super
|
18
|
-
@prediction = CustomV1Document.new(prediction['prediction'], nil)
|
19
|
-
@pages = []
|
20
|
-
prediction['pages'].each do |page|
|
21
|
-
@pages.push(CustomV1Page.new(page))
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class << self
|
26
|
-
# Name of the endpoint for this product.
|
27
|
-
# @return [String]
|
28
|
-
attr_reader :endpoint_name
|
29
|
-
# Version for this product.
|
30
|
-
# @return [String]
|
31
|
-
attr_reader :endpoint_version
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../../parsing'
|
4
|
-
|
5
|
-
module Mindee
|
6
|
-
module Product
|
7
|
-
module Custom
|
8
|
-
# Custom Document V1 prediction
|
9
|
-
class CustomV1Document < Mindee::Parsing::Common::Prediction
|
10
|
-
# All value fields in the document
|
11
|
-
# @return [Hash<Symbol, Mindee::Parsing::Custom::ListField>]
|
12
|
-
attr_reader :fields
|
13
|
-
# All classifications in the document
|
14
|
-
# @return [Hash<Symbol, Mindee::Parsing::Custom::ClassificationField>]
|
15
|
-
attr_reader :classifications
|
16
|
-
|
17
|
-
# @param prediction [Hash]
|
18
|
-
# @param page_id [Integer, nil]
|
19
|
-
def initialize(prediction, page_id)
|
20
|
-
super()
|
21
|
-
@fields = {}
|
22
|
-
@classifications = {}
|
23
|
-
prediction.each do |field_name, field_prediction|
|
24
|
-
field_sym = field_name.to_sym
|
25
|
-
set_field(field_sym, field_prediction, page_id)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# @return [String]
|
30
|
-
def to_s
|
31
|
-
out_str = String.new
|
32
|
-
@classifications.each do |name, info|
|
33
|
-
out_str << "\n:#{name}: #{info}".rstrip
|
34
|
-
end
|
35
|
-
@fields.each do |name, info|
|
36
|
-
out_str << "\n:#{name}: #{info}".rstrip
|
37
|
-
end
|
38
|
-
out_str[1..].to_s
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
# @param field_prediction [Hash]
|
44
|
-
def set_field(field_sym, field_prediction, page_id)
|
45
|
-
# Currently two types of fields possible in a custom API response:
|
46
|
-
# fields having a list of values, and classification fields.
|
47
|
-
# Here we use the fact that only value lists have the 'values' attribute.
|
48
|
-
|
49
|
-
if field_prediction.key? 'values'
|
50
|
-
@fields[field_sym] = Parsing::Custom::ListField.new(field_prediction, page_id)
|
51
|
-
elsif field_prediction.key? 'value'
|
52
|
-
@classifications[field_sym] = Parsing::Custom::ClassificationField.new(field_prediction)
|
53
|
-
else
|
54
|
-
throw 'Unknown API field type'
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../../parsing'
|
4
|
-
require_relative 'custom_v1_document'
|
5
|
-
|
6
|
-
module Mindee
|
7
|
-
module Product
|
8
|
-
module Custom
|
9
|
-
# Custom Document V1 page.
|
10
|
-
class CustomV1Page < Mindee::Parsing::Common::Page
|
11
|
-
# @param prediction [Hash]
|
12
|
-
def initialize(prediction)
|
13
|
-
super(prediction)
|
14
|
-
@prediction = CustomV1PagePrediction.new(
|
15
|
-
prediction['prediction'],
|
16
|
-
prediction['id']
|
17
|
-
)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# Custom Document V1 page prediction.
|
22
|
-
class CustomV1PagePrediction < CustomV1Document
|
23
|
-
# @return [String]
|
24
|
-
def to_s
|
25
|
-
out_str = String.new
|
26
|
-
out_str << "\n#{super}"
|
27
|
-
out_str
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../../../parsing'
|
4
|
-
require_relative 'driver_license_v1_document'
|
5
|
-
require_relative 'driver_license_v1_page'
|
6
|
-
|
7
|
-
module Mindee
|
8
|
-
module Product
|
9
|
-
module EU
|
10
|
-
# Driver License module.
|
11
|
-
module DriverLicense
|
12
|
-
# Driver License API version 1 inference prediction.
|
13
|
-
class DriverLicenseV1 < Mindee::Parsing::Common::Inference
|
14
|
-
@endpoint_name = 'eu_driver_license'
|
15
|
-
@endpoint_version = '1'
|
16
|
-
|
17
|
-
# @param prediction [Hash]
|
18
|
-
def initialize(prediction)
|
19
|
-
super
|
20
|
-
@prediction = DriverLicenseV1Document.new(prediction['prediction'], nil)
|
21
|
-
@pages = []
|
22
|
-
prediction['pages'].each do |page|
|
23
|
-
if page.key?('prediction') && !page['prediction'].nil? && !page['prediction'].empty?
|
24
|
-
@pages.push(DriverLicenseV1Page.new(page))
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
class << self
|
30
|
-
# Name of the endpoint for this product.
|
31
|
-
# @return [String]
|
32
|
-
attr_reader :endpoint_name
|
33
|
-
# Version for this product.
|
34
|
-
# @return [String]
|
35
|
-
attr_reader :endpoint_version
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|