mindee-lite 5.0.0.beta1
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 +7 -0
- data/.editorconfig +24 -0
- data/.gitattributes +14 -0
- data/.gitignore +76 -0
- data/.gitmodules +3 -0
- data/.pre-commit-config.yaml +36 -0
- data/.rubocop.yml +49 -0
- data/.yardopts +4 -0
- data/CHANGELOG.md +515 -0
- data/CODE_OF_CONDUCT.md +129 -0
- data/CONTRIBUTING.md +107 -0
- data/Gemfile +14 -0
- data/LICENSE +21 -0
- data/README.md +42 -0
- data/Rakefile +40 -0
- data/Steepfile +30 -0
- data/bin/console +14 -0
- data/bin/mindee.rb +30 -0
- data/bin/v1/parser.rb +153 -0
- data/bin/v1/products.rb +88 -0
- data/bin/v2/parser.rb +235 -0
- data/bin/v2/products.rb +34 -0
- data/docs/code_samples/bank_account_details_v1.txt +24 -0
- data/docs/code_samples/bank_account_details_v2.txt +24 -0
- data/docs/code_samples/bank_statement_fr_v2_async.txt +24 -0
- data/docs/code_samples/barcode_reader_v1.txt +24 -0
- data/docs/code_samples/cropper_v1.txt +21 -0
- data/docs/code_samples/default.txt +30 -0
- data/docs/code_samples/default_async.txt +29 -0
- data/docs/code_samples/expense_receipts_v5.txt +25 -0
- data/docs/code_samples/expense_receipts_v5_async.txt +24 -0
- data/docs/code_samples/financial_document_v1.txt +25 -0
- data/docs/code_samples/financial_document_v1_async.txt +24 -0
- data/docs/code_samples/idcard_fr_v1.txt +24 -0
- data/docs/code_samples/idcard_fr_v2.txt +24 -0
- data/docs/code_samples/international_id_v2_async.txt +24 -0
- data/docs/code_samples/invoice_splitter_v1_async.txt +24 -0
- data/docs/code_samples/invoices_v4.txt +25 -0
- data/docs/code_samples/invoices_v4_async.txt +24 -0
- data/docs/code_samples/multi_receipts_detector_v1.txt +24 -0
- data/docs/code_samples/passport_v1.txt +24 -0
- data/docs/code_samples/resume_v1_async.txt +24 -0
- data/docs/code_samples/v2_classification.txt +30 -0
- data/docs/code_samples/v2_crop.txt +30 -0
- data/docs/code_samples/v2_extraction.txt +42 -0
- data/docs/code_samples/v2_extraction_webhook.txt +45 -0
- data/docs/code_samples/v2_ocr.txt +30 -0
- data/docs/code_samples/v2_split.txt +30 -0
- data/docs/code_samples/workflow_execution.txt +28 -0
- data/docs/code_samples/workflow_polling.txt +35 -0
- data/examples/auto_invoice_splitter_extraction.rb +48 -0
- data/examples/auto_multi_receipts_detector_extraction.rb +30 -0
- data/lib/mindee/dependency.rb +29 -0
- data/lib/mindee/error/mindee_error.rb +17 -0
- data/lib/mindee/error/mindee_http_error.rb +36 -0
- data/lib/mindee/error/mindee_http_error_v2.rb +45 -0
- data/lib/mindee/error/mindee_http_unknown_error_v2.rb +18 -0
- data/lib/mindee/error/mindee_input_error.rb +30 -0
- data/lib/mindee/error.rb +6 -0
- data/lib/mindee/geometry/min_max.rb +23 -0
- data/lib/mindee/geometry/point.rb +41 -0
- data/lib/mindee/geometry/polygon.rb +37 -0
- data/lib/mindee/geometry/quadrilateral.rb +50 -0
- data/lib/mindee/geometry/utils.rb +88 -0
- data/lib/mindee/geometry.rb +7 -0
- data/lib/mindee/http/.rubocop.yml +7 -0
- data/lib/mindee/http/http_error_handler.rb +106 -0
- data/lib/mindee/http/response_validation.rb +81 -0
- data/lib/mindee/http.rb +3 -0
- data/lib/mindee/image/extracted_image.rb +89 -0
- data/lib/mindee/image/image_compressor.rb +29 -0
- data/lib/mindee/image/image_extractor.rb +118 -0
- data/lib/mindee/image/image_utils.rb +165 -0
- data/lib/mindee/image.rb +6 -0
- data/lib/mindee/input/base_parameters.rb +149 -0
- data/lib/mindee/input/local_response.rb +80 -0
- data/lib/mindee/input/polling_options.rb +26 -0
- data/lib/mindee/input/sources/base64_input_source.rb +31 -0
- data/lib/mindee/input/sources/bytes_input_source.rb +21 -0
- data/lib/mindee/input/sources/file_input_source.rb +20 -0
- data/lib/mindee/input/sources/local_input_source.rb +216 -0
- data/lib/mindee/input/sources/path_input_source.rb +20 -0
- data/lib/mindee/input/sources/url_input_source.rb +130 -0
- data/lib/mindee/input/sources.rb +8 -0
- data/lib/mindee/input.rb +4 -0
- data/lib/mindee/logging/logger.rb +24 -0
- data/lib/mindee/logging.rb +3 -0
- data/lib/mindee/page_options.rb +24 -0
- data/lib/mindee/pdf/extracted_pdf.rb +70 -0
- data/lib/mindee/pdf/pdf_compressor.rb +121 -0
- data/lib/mindee/pdf/pdf_extractor.rb +121 -0
- data/lib/mindee/pdf/pdf_processor.rb +91 -0
- data/lib/mindee/pdf/pdf_tools.rb +201 -0
- data/lib/mindee/pdf.rb +7 -0
- data/lib/mindee/v1/client.rb +490 -0
- data/lib/mindee/v1/extraction/multi_receipts_extractor.rb +32 -0
- data/lib/mindee/v1/extraction.rb +3 -0
- data/lib/mindee/v1/http/.rubocop.yml +7 -0
- data/lib/mindee/v1/http/endpoint.rb +221 -0
- data/lib/mindee/v1/http/workflow_endpoint.rb +93 -0
- data/lib/mindee/v1/http.rb +4 -0
- data/lib/mindee/v1/parsing/common/api_request.rb +38 -0
- data/lib/mindee/v1/parsing/common/api_response.rb +63 -0
- data/lib/mindee/v1/parsing/common/document.rb +86 -0
- data/lib/mindee/v1/parsing/common/execution.rb +78 -0
- data/lib/mindee/v1/parsing/common/execution_file.rb +26 -0
- data/lib/mindee/v1/parsing/common/execution_priority.rb +38 -0
- data/lib/mindee/v1/parsing/common/extras/cropper_extra.rb +32 -0
- data/lib/mindee/v1/parsing/common/extras/extras.rb +62 -0
- data/lib/mindee/v1/parsing/common/extras/full_text_ocr_extra.rb +35 -0
- data/lib/mindee/v1/parsing/common/extras/rag_extra.rb +28 -0
- data/lib/mindee/v1/parsing/common/extras.rb +6 -0
- data/lib/mindee/v1/parsing/common/inference.rb +69 -0
- data/lib/mindee/v1/parsing/common/job.rb +48 -0
- data/lib/mindee/v1/parsing/common/ocr/mvision_v1.rb +52 -0
- data/lib/mindee/v1/parsing/common/ocr/ocr.rb +180 -0
- data/lib/mindee/v1/parsing/common/ocr.rb +3 -0
- data/lib/mindee/v1/parsing/common/orientation.rb +28 -0
- data/lib/mindee/v1/parsing/common/page.rb +49 -0
- data/lib/mindee/v1/parsing/common/prediction.rb +19 -0
- data/lib/mindee/v1/parsing/common/product.rb +26 -0
- data/lib/mindee/v1/parsing/common/workflow_response.rb +30 -0
- data/lib/mindee/v1/parsing/common.rb +15 -0
- data/lib/mindee/v1/parsing/standard/abstract_field.rb +74 -0
- data/lib/mindee/v1/parsing/standard/address_field.rb +51 -0
- data/lib/mindee/v1/parsing/standard/amount_field.rb +28 -0
- data/lib/mindee/v1/parsing/standard/base_field.rb +30 -0
- data/lib/mindee/v1/parsing/standard/boolean_field.rb +29 -0
- data/lib/mindee/v1/parsing/standard/classification_field.rb +18 -0
- data/lib/mindee/v1/parsing/standard/company_registration_field.rb +45 -0
- data/lib/mindee/v1/parsing/standard/date_field.rb +40 -0
- data/lib/mindee/v1/parsing/standard/feature_field.rb +26 -0
- data/lib/mindee/v1/parsing/standard/locale_field.rb +52 -0
- data/lib/mindee/v1/parsing/standard/payment_details_field.rb +44 -0
- data/lib/mindee/v1/parsing/standard/position_field.rb +61 -0
- data/lib/mindee/v1/parsing/standard/string_field.rb +26 -0
- data/lib/mindee/v1/parsing/standard/tax_field.rb +110 -0
- data/lib/mindee/v1/parsing/standard.rb +15 -0
- data/lib/mindee/v1/parsing/universal/universal_list_field.rb +60 -0
- data/lib/mindee/v1/parsing/universal/universal_object_field.rb +123 -0
- data/lib/mindee/v1/parsing/universal.rb +4 -0
- data/lib/mindee/v1/parsing.rb +5 -0
- data/lib/mindee/v1/product/.rubocop.yml +12 -0
- data/lib/mindee/v1/product/barcode_reader/barcode_reader_v1.rb +47 -0
- data/lib/mindee/v1/product/barcode_reader/barcode_reader_v1_document.rb +47 -0
- data/lib/mindee/v1/product/barcode_reader/barcode_reader_v1_page.rb +38 -0
- data/lib/mindee/v1/product/cropper/cropper_v1.rb +47 -0
- data/lib/mindee/v1/product/cropper/cropper_v1_document.rb +15 -0
- data/lib/mindee/v1/product/cropper/cropper_v1_page.rb +55 -0
- data/lib/mindee/v1/product/financial_document/financial_document_v1.rb +47 -0
- data/lib/mindee/v1/product/financial_document/financial_document_v1_document.rb +329 -0
- data/lib/mindee/v1/product/financial_document/financial_document_v1_line_item.rb +124 -0
- data/lib/mindee/v1/product/financial_document/financial_document_v1_line_items.rb +64 -0
- data/lib/mindee/v1/product/financial_document/financial_document_v1_page.rb +38 -0
- data/lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v1.rb +49 -0
- data/lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v1_document.rb +49 -0
- data/lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v1_page.rb +40 -0
- data/lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v2.rb +49 -0
- data/lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v2_bban.rb +63 -0
- data/lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v2_document.rb +60 -0
- data/lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v2_page.rb +40 -0
- data/lib/mindee/v1/product/fr/bank_statement/bank_statement_v2.rb +49 -0
- data/lib/mindee/v1/product/fr/bank_statement/bank_statement_v2_document.rb +169 -0
- data/lib/mindee/v1/product/fr/bank_statement/bank_statement_v2_page.rb +40 -0
- data/lib/mindee/v1/product/fr/bank_statement/bank_statement_v2_transaction.rb +78 -0
- data/lib/mindee/v1/product/fr/bank_statement/bank_statement_v2_transactions.rb +56 -0
- data/lib/mindee/v1/product/fr/id_card/id_card_v1.rb +49 -0
- data/lib/mindee/v1/product/fr/id_card/id_card_v1_document.rb +106 -0
- data/lib/mindee/v1/product/fr/id_card/id_card_v1_page.rb +57 -0
- data/lib/mindee/v1/product/fr/id_card/id_card_v2.rb +49 -0
- data/lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb +143 -0
- data/lib/mindee/v1/product/fr/id_card/id_card_v2_page.rb +65 -0
- data/lib/mindee/v1/product/international_id/international_id_v2.rb +47 -0
- data/lib/mindee/v1/product/international_id/international_id_v2_document.rb +164 -0
- data/lib/mindee/v1/product/international_id/international_id_v2_page.rb +38 -0
- data/lib/mindee/v1/product/invoice/invoice_v4.rb +47 -0
- data/lib/mindee/v1/product/invoice/invoice_v4_document.rb +300 -0
- data/lib/mindee/v1/product/invoice/invoice_v4_line_item.rb +124 -0
- data/lib/mindee/v1/product/invoice/invoice_v4_line_items.rb +64 -0
- data/lib/mindee/v1/product/invoice/invoice_v4_page.rb +38 -0
- data/lib/mindee/v1/product/invoice_splitter/invoice_splitter_v1.rb +47 -0
- data/lib/mindee/v1/product/invoice_splitter/invoice_splitter_v1_document.rb +66 -0
- data/lib/mindee/v1/product/invoice_splitter/invoice_splitter_v1_invoice_page_group.rb +58 -0
- data/lib/mindee/v1/product/invoice_splitter/invoice_splitter_v1_invoice_page_groups.rb +50 -0
- data/lib/mindee/v1/product/invoice_splitter/invoice_splitter_v1_page.rb +38 -0
- data/lib/mindee/v1/product/multi_receipts_detector/multi_receipts_detector_v1.rb +47 -0
- data/lib/mindee/v1/product/multi_receipts_detector/multi_receipts_detector_v1_document.rb +38 -0
- data/lib/mindee/v1/product/multi_receipts_detector/multi_receipts_detector_v1_page.rb +38 -0
- data/lib/mindee/v1/product/passport/passport_v1.rb +47 -0
- data/lib/mindee/v1/product/passport/passport_v1_document.rb +112 -0
- data/lib/mindee/v1/product/passport/passport_v1_page.rb +38 -0
- data/lib/mindee/v1/product/receipt/receipt_v5.rb +47 -0
- data/lib/mindee/v1/product/receipt/receipt_v5_document.rb +187 -0
- data/lib/mindee/v1/product/receipt/receipt_v5_line_item.rb +88 -0
- data/lib/mindee/v1/product/receipt/receipt_v5_line_items.rb +56 -0
- data/lib/mindee/v1/product/receipt/receipt_v5_page.rb +38 -0
- data/lib/mindee/v1/product/resume/resume_v1.rb +47 -0
- data/lib/mindee/v1/product/resume/resume_v1_certificate.rb +82 -0
- data/lib/mindee/v1/product/resume/resume_v1_certificates.rb +60 -0
- data/lib/mindee/v1/product/resume/resume_v1_document.rb +340 -0
- data/lib/mindee/v1/product/resume/resume_v1_education.rb +106 -0
- data/lib/mindee/v1/product/resume/resume_v1_educations.rb +66 -0
- data/lib/mindee/v1/product/resume/resume_v1_language.rb +66 -0
- data/lib/mindee/v1/product/resume/resume_v1_languages.rb +56 -0
- data/lib/mindee/v1/product/resume/resume_v1_page.rb +38 -0
- data/lib/mindee/v1/product/resume/resume_v1_professional_experience.rb +122 -0
- data/lib/mindee/v1/product/resume/resume_v1_professional_experiences.rb +70 -0
- data/lib/mindee/v1/product/resume/resume_v1_social_networks_url.rb +66 -0
- data/lib/mindee/v1/product/resume/resume_v1_social_networks_urls.rb +56 -0
- data/lib/mindee/v1/product/universal/universal.rb +48 -0
- data/lib/mindee/v1/product/universal/universal_document.rb +35 -0
- data/lib/mindee/v1/product/universal/universal_page.rb +54 -0
- data/lib/mindee/v1/product/universal/universal_prediction.rb +128 -0
- data/lib/mindee/v1/product.rb +18 -0
- data/lib/mindee/v1.rb +7 -0
- data/lib/mindee/v2/client.rb +132 -0
- data/lib/mindee/v2/file_operation/crop.rb +51 -0
- data/lib/mindee/v2/file_operation/crop_files.rb +25 -0
- data/lib/mindee/v2/file_operation/split.rb +37 -0
- data/lib/mindee/v2/file_operation/split_files.rb +25 -0
- data/lib/mindee/v2/file_operation.rb +6 -0
- data/lib/mindee/v2/http/.rubocop.yml +7 -0
- data/lib/mindee/v2/http/api_v2_settings.rb +65 -0
- data/lib/mindee/v2/http/mindee_api_v2.rb +230 -0
- data/lib/mindee/v2/http.rb +4 -0
- data/lib/mindee/v2/parsing/base_inference.rb +44 -0
- data/lib/mindee/v2/parsing/base_response.rb +15 -0
- data/lib/mindee/v2/parsing/common_response.rb +20 -0
- data/lib/mindee/v2/parsing/error_item.rb +21 -0
- data/lib/mindee/v2/parsing/error_response.rb +51 -0
- data/lib/mindee/v2/parsing/field/base_field.rb +63 -0
- data/lib/mindee/v2/parsing/field/field_confidence.rb +128 -0
- data/lib/mindee/v2/parsing/field/field_location.rb +33 -0
- data/lib/mindee/v2/parsing/field/inference_fields.rb +105 -0
- data/lib/mindee/v2/parsing/field/list_field.rb +79 -0
- data/lib/mindee/v2/parsing/field/object_field.rb +138 -0
- data/lib/mindee/v2/parsing/field/simple_field.rb +60 -0
- data/lib/mindee/v2/parsing/field.rb +9 -0
- data/lib/mindee/v2/parsing/inference_active_options.rb +67 -0
- data/lib/mindee/v2/parsing/inference_file.rb +38 -0
- data/lib/mindee/v2/parsing/inference_job.rb +25 -0
- data/lib/mindee/v2/parsing/inference_model.rb +30 -0
- data/lib/mindee/v2/parsing/job.rb +93 -0
- data/lib/mindee/v2/parsing/job_response.rb +30 -0
- data/lib/mindee/v2/parsing/job_webhook.rb +59 -0
- data/lib/mindee/v2/parsing/rag_metadata.rb +17 -0
- data/lib/mindee/v2/parsing/raw_text.rb +27 -0
- data/lib/mindee/v2/parsing/raw_text_page.rb +24 -0
- data/lib/mindee/v2/parsing/search/pagination_metadata.rb +44 -0
- data/lib/mindee/v2/parsing/search/search_model.rb +38 -0
- data/lib/mindee/v2/parsing/search/search_models.rb +34 -0
- data/lib/mindee/v2/parsing/search/search_response.rb +38 -0
- data/lib/mindee/v2/parsing/search.rb +6 -0
- data/lib/mindee/v2/parsing.rb +16 -0
- data/lib/mindee/v2/product/base_product.rb +28 -0
- data/lib/mindee/v2/product/classification/classification.rb +20 -0
- data/lib/mindee/v2/product/classification/classification_classifier.rb +25 -0
- data/lib/mindee/v2/product/classification/classification_inference.rb +35 -0
- data/lib/mindee/v2/product/classification/classification_response.rb +32 -0
- data/lib/mindee/v2/product/classification/classification_result.rb +27 -0
- data/lib/mindee/v2/product/classification/params/classification_parameters.rb +47 -0
- data/lib/mindee/v2/product/crop/crop.rb +20 -0
- data/lib/mindee/v2/product/crop/crop_inference.rb +34 -0
- data/lib/mindee/v2/product/crop/crop_item.rb +39 -0
- data/lib/mindee/v2/product/crop/crop_response.rb +40 -0
- data/lib/mindee/v2/product/crop/crop_result.rb +34 -0
- data/lib/mindee/v2/product/crop/params/crop_parameters.rb +47 -0
- data/lib/mindee/v2/product/extraction/extraction.rb +21 -0
- data/lib/mindee/v2/product/extraction/extraction_inference.rb +40 -0
- data/lib/mindee/v2/product/extraction/extraction_response.rb +32 -0
- data/lib/mindee/v2/product/extraction/extraction_result.rb +44 -0
- data/lib/mindee/v2/product/extraction/params/data_schema.rb +51 -0
- data/lib/mindee/v2/product/extraction/params/data_schema_field.rb +69 -0
- data/lib/mindee/v2/product/extraction/params/data_schema_replace.rb +39 -0
- data/lib/mindee/v2/product/extraction/params/extraction_parameters.rb +125 -0
- data/lib/mindee/v2/product/ocr/ocr.rb +20 -0
- data/lib/mindee/v2/product/ocr/ocr_inference.rb +34 -0
- data/lib/mindee/v2/product/ocr/ocr_page.rb +33 -0
- data/lib/mindee/v2/product/ocr/ocr_response.rb +32 -0
- data/lib/mindee/v2/product/ocr/ocr_result.rb +34 -0
- data/lib/mindee/v2/product/ocr/ocr_word.rb +29 -0
- data/lib/mindee/v2/product/ocr/params/ocr_parameters.rb +47 -0
- data/lib/mindee/v2/product/split/params/split_parameters.rb +48 -0
- data/lib/mindee/v2/product/split/split.rb +19 -0
- data/lib/mindee/v2/product/split/split_inference.rb +34 -0
- data/lib/mindee/v2/product/split/split_range.rb +38 -0
- data/lib/mindee/v2/product/split/split_response.rb +40 -0
- data/lib/mindee/v2/product/split/split_result.rb +34 -0
- data/lib/mindee/v2/product.rb +7 -0
- data/lib/mindee/v2.rb +7 -0
- data/lib/mindee/version.rb +26 -0
- data/lib/mindee.rb +135 -0
- data/mindee-lite.gemspec +36 -0
- data/mindee.gemspec +44 -0
- data/sig/custom/marcel.rbs +3 -0
- data/sig/custom/mini_magick.rbs +31 -0
- data/sig/custom/net_http.rbs +43 -0
- data/sig/custom/origami.rbs +59 -0
- data/sig/mindee/dependency.rbs +13 -0
- data/sig/mindee/error/mindee_error.rbs +13 -0
- data/sig/mindee/error/mindee_http_error.rbs +17 -0
- data/sig/mindee/error/mindee_http_error_v2.rbs +15 -0
- data/sig/mindee/error/mindee_http_unknown_error_v2.rbs +9 -0
- data/sig/mindee/error/mindee_input_error.rbs +18 -0
- data/sig/mindee/geometry/min_max.rbs +11 -0
- data/sig/mindee/geometry/point.rbs +14 -0
- data/sig/mindee/geometry/polygon.rbs +12 -0
- data/sig/mindee/geometry/quadrilateral.rbs +15 -0
- data/sig/mindee/geometry/utils.rbs +13 -0
- data/sig/mindee/http/http_error_handler.rbs +15 -0
- data/sig/mindee/http/response_validation.rbs +11 -0
- data/sig/mindee/image/extracted_image.rbs +21 -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/base_parameters.rbs +35 -0
- data/sig/mindee/input/local_response.rbs +14 -0
- data/sig/mindee/input/polling_options.rbs +12 -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 +30 -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 +11 -0
- data/sig/mindee/page_options.rbs +11 -0
- data/sig/mindee/pdf/extracted_pdf.rbs +17 -0
- data/sig/mindee/pdf/pdf_compressor.rbs +15 -0
- data/sig/mindee/pdf/pdf_extractor.rbs +19 -0
- data/sig/mindee/pdf/pdf_processor.rbs +12 -0
- data/sig/mindee/pdf/pdf_tools.rbs +31 -0
- data/sig/mindee/v1/client.rbs +84 -0
- data/sig/mindee/v1/extraction/multi_receipts_extractor.rbs +8 -0
- data/sig/mindee/v1/http/endpoint.rbs +41 -0
- data/sig/mindee/v1/http/workflow_endpoint.rbs +22 -0
- data/sig/mindee/v1/parsing/common/api_request.rbs +22 -0
- data/sig/mindee/v1/parsing/common/api_response.rbs +31 -0
- data/sig/mindee/v1/parsing/common/document.rbs +32 -0
- data/sig/mindee/v1/parsing/common/execution.rbs +26 -0
- data/sig/mindee/v1/parsing/common/execution_file.rbs +16 -0
- data/sig/mindee/v1/parsing/common/execution_priority.rbs +16 -0
- data/sig/mindee/v1/parsing/common/extras/cropper_extra.rbs +18 -0
- data/sig/mindee/v1/parsing/common/extras/extras.rbs +24 -0
- data/sig/mindee/v1/parsing/common/extras/full_text_ocr_extra.rbs +22 -0
- data/sig/mindee/v1/parsing/common/extras/rag_extra.rbs +19 -0
- data/sig/mindee/v1/parsing/common/inference.rbs +31 -0
- data/sig/mindee/v1/parsing/common/job.rbs +24 -0
- data/sig/mindee/v1/parsing/common/ocr/mvision_v1.rbs +20 -0
- data/sig/mindee/v1/parsing/common/ocr/ocr.rbs +56 -0
- data/sig/mindee/v1/parsing/common/orientation.rbs +15 -0
- data/sig/mindee/v1/parsing/common/page.rbs +19 -0
- data/sig/mindee/v1/parsing/common/prediction.rbs +14 -0
- data/sig/mindee/v1/parsing/common/product.rbs +16 -0
- data/sig/mindee/v1/parsing/common/workflow_response.rbs +22 -0
- data/sig/mindee/v1/parsing/standard/abstract_field.rbs +30 -0
- data/sig/mindee/v1/parsing/standard/address_field.rbs +28 -0
- data/sig/mindee/v1/parsing/standard/amount_field.rbs +16 -0
- data/sig/mindee/v1/parsing/standard/base_field.rbs +16 -0
- data/sig/mindee/v1/parsing/standard/boolean_field.rbs +16 -0
- data/sig/mindee/v1/parsing/standard/classification_field.rbs +12 -0
- data/sig/mindee/v1/parsing/standard/company_registration_field.rbs +20 -0
- data/sig/mindee/v1/parsing/standard/date_field.rbs +20 -0
- data/sig/mindee/v1/parsing/standard/feature_field.rbs +12 -0
- data/sig/mindee/v1/parsing/standard/locale_field.rbs +24 -0
- data/sig/mindee/v1/parsing/standard/payment_details_field.rbs +19 -0
- data/sig/mindee/v1/parsing/standard/position_field.rbs +26 -0
- data/sig/mindee/v1/parsing/standard/string_field.rbs +16 -0
- data/sig/mindee/v1/parsing/standard/tax_field.rbs +33 -0
- data/sig/mindee/v1/parsing/universal/universal_list_field.rbs +21 -0
- data/sig/mindee/v1/parsing/universal/universal_object_field.rbs +38 -0
- data/sig/mindee/v1/product/barcode_reader/barcode_reader_v1.rbs +13 -0
- data/sig/mindee/v1/product/barcode_reader/barcode_reader_v1_document.rbs +16 -0
- data/sig/mindee/v1/product/barcode_reader/barcode_reader_v1_page.rbs +17 -0
- data/sig/mindee/v1/product/cropper/cropper_v1.rbs +13 -0
- data/sig/mindee/v1/product/cropper/cropper_v1_document.rbs +14 -0
- data/sig/mindee/v1/product/cropper/cropper_v1_page.rbs +19 -0
- data/sig/mindee/v1/product/financial_document/financial_document_v1.rbs +13 -0
- data/sig/mindee/v1/product/financial_document/financial_document_v1_document.rbs +49 -0
- data/sig/mindee/v1/product/financial_document/financial_document_v1_line_item.rbs +35 -0
- data/sig/mindee/v1/product/financial_document/financial_document_v1_line_items.rbs +15 -0
- data/sig/mindee/v1/product/financial_document/financial_document_v1_page.rbs +17 -0
- data/sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v1.rbs +15 -0
- data/sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v1_document.rbs +19 -0
- data/sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v1_page.rbs +19 -0
- data/sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v2.rbs +15 -0
- data/sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v2_bban.rbs +25 -0
- data/sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v2_document.rbs +20 -0
- data/sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v2_page.rbs +19 -0
- data/sig/mindee/v1/product/fr/bank_statement/bank_statement_v2.rbs +15 -0
- data/sig/mindee/v1/product/fr/bank_statement/bank_statement_v2_document.rbs +31 -0
- data/sig/mindee/v1/product/fr/bank_statement/bank_statement_v2_page.rbs +19 -0
- data/sig/mindee/v1/product/fr/bank_statement/bank_statement_v2_transaction.rbs +27 -0
- data/sig/mindee/v1/product/fr/bank_statement/bank_statement_v2_transactions.rbs +17 -0
- data/sig/mindee/v1/product/fr/id_card/id_card_v1.rbs +15 -0
- data/sig/mindee/v1/product/fr/id_card/id_card_v1_document.rbs +26 -0
- data/sig/mindee/v1/product/fr/id_card/id_card_v1_page.rbs +20 -0
- data/sig/mindee/v1/product/fr/id_card/id_card_v2.rbs +15 -0
- data/sig/mindee/v1/product/fr/id_card/id_card_v2_document.rbs +31 -0
- data/sig/mindee/v1/product/fr/id_card/id_card_v2_page.rbs +21 -0
- data/sig/mindee/v1/product/international_id/international_id_v2.rbs +13 -0
- data/sig/mindee/v1/product/international_id/international_id_v2_document.rbs +31 -0
- data/sig/mindee/v1/product/international_id/international_id_v2_page.rbs +17 -0
- data/sig/mindee/v1/product/invoice/invoice_v4.rbs +13 -0
- data/sig/mindee/v1/product/invoice/invoice_v4_document.rbs +45 -0
- data/sig/mindee/v1/product/invoice/invoice_v4_line_item.rbs +35 -0
- data/sig/mindee/v1/product/invoice/invoice_v4_line_items.rbs +15 -0
- data/sig/mindee/v1/product/invoice/invoice_v4_page.rbs +17 -0
- data/sig/mindee/v1/product/invoice_splitter/invoice_splitter_v1.rbs +13 -0
- data/sig/mindee/v1/product/invoice_splitter/invoice_splitter_v1_document.rbs +17 -0
- data/sig/mindee/v1/product/invoice_splitter/invoice_splitter_v1_invoice_page_group.rbs +21 -0
- data/sig/mindee/v1/product/invoice_splitter/invoice_splitter_v1_invoice_page_groups.rbs +15 -0
- data/sig/mindee/v1/product/invoice_splitter/invoice_splitter_v1_page.rbs +17 -0
- data/sig/mindee/v1/product/multi_receipts_detector/multi_receipts_detector_v1.rbs +14 -0
- data/sig/mindee/v1/product/multi_receipts_detector/multi_receipts_detector_v1_document.rbs +15 -0
- data/sig/mindee/v1/product/multi_receipts_detector/multi_receipts_detector_v1_page.rbs +17 -0
- data/sig/mindee/v1/product/passport/passport_v1.rbs +13 -0
- data/sig/mindee/v1/product/passport/passport_v1_document.rbs +25 -0
- data/sig/mindee/v1/product/passport/passport_v1_page.rbs +17 -0
- data/sig/mindee/v1/product/receipt/receipt_v5.rbs +13 -0
- data/sig/mindee/v1/product/receipt/receipt_v5_document.rbs +33 -0
- data/sig/mindee/v1/product/receipt/receipt_v5_line_item.rbs +27 -0
- data/sig/mindee/v1/product/receipt/receipt_v5_line_items.rbs +15 -0
- data/sig/mindee/v1/product/receipt/receipt_v5_page.rbs +17 -0
- data/sig/mindee/v1/product/resume/resume_v1.rbs +13 -0
- data/sig/mindee/v1/product/resume/resume_v1_certificate.rbs +27 -0
- data/sig/mindee/v1/product/resume/resume_v1_certificates.rbs +17 -0
- data/sig/mindee/v1/product/resume/resume_v1_document.rbs +69 -0
- data/sig/mindee/v1/product/resume/resume_v1_education.rbs +33 -0
- data/sig/mindee/v1/product/resume/resume_v1_educations.rbs +17 -0
- data/sig/mindee/v1/product/resume/resume_v1_language.rbs +23 -0
- data/sig/mindee/v1/product/resume/resume_v1_languages.rbs +17 -0
- data/sig/mindee/v1/product/resume/resume_v1_page.rbs +19 -0
- data/sig/mindee/v1/product/resume/resume_v1_professional_experience.rbs +37 -0
- data/sig/mindee/v1/product/resume/resume_v1_professional_experiences.rbs +17 -0
- data/sig/mindee/v1/product/resume/resume_v1_social_networks_url.rbs +23 -0
- data/sig/mindee/v1/product/resume/resume_v1_social_networks_urls.rbs +17 -0
- data/sig/mindee/v1/product/universal/universal.rbs +16 -0
- data/sig/mindee/v1/product/universal/universal_document.rbs +12 -0
- data/sig/mindee/v1/product/universal/universal_page.rbs +18 -0
- data/sig/mindee/v1/product/universal/universal_prediction.rbs +30 -0
- data/sig/mindee/v2/client.rbs +29 -0
- data/sig/mindee/v2/file_operation/crop.rbs +10 -0
- data/sig/mindee/v2/file_operation/crop_files.rbs +9 -0
- data/sig/mindee/v2/file_operation/split.rbs +11 -0
- data/sig/mindee/v2/file_operation/split_files.rbs +9 -0
- data/sig/mindee/v2/http/api_v2_settings.rbs +27 -0
- data/sig/mindee/v2/http/mindee_api_v2.rbs +52 -0
- data/sig/mindee/v2/parsing/base_inference.rbs +18 -0
- data/sig/mindee/v2/parsing/base_response.rbs +11 -0
- data/sig/mindee/v2/parsing/common_response.rbs +12 -0
- data/sig/mindee/v2/parsing/error_item.rbs +13 -0
- data/sig/mindee/v2/parsing/error_response.rbs +20 -0
- data/sig/mindee/v2/parsing/field/base_field.rbs +17 -0
- data/sig/mindee/v2/parsing/field/field_confidence.rbs +30 -0
- data/sig/mindee/v2/parsing/field/field_location.rbs +16 -0
- data/sig/mindee/v2/parsing/field/inference_fields.rbs +20 -0
- data/sig/mindee/v2/parsing/field/list_field.rbs +23 -0
- data/sig/mindee/v2/parsing/field/object_field.rbs +27 -0
- data/sig/mindee/v2/parsing/field/simple_field.rbs +16 -0
- data/sig/mindee/v2/parsing/inference_active_options.rbs +26 -0
- data/sig/mindee/v2/parsing/inference_file.rbs +17 -0
- data/sig/mindee/v2/parsing/inference_job.rbs +13 -0
- data/sig/mindee/v2/parsing/inference_model.rbs +12 -0
- data/sig/mindee/v2/parsing/job.rbs +24 -0
- data/sig/mindee/v2/parsing/job_response.rbs +14 -0
- data/sig/mindee/v2/parsing/job_webhook.rbs +19 -0
- data/sig/mindee/v2/parsing/rag_metadata.rbs +13 -0
- data/sig/mindee/v2/parsing/raw_text.rbs +12 -0
- data/sig/mindee/v2/parsing/raw_text_page.rbs +11 -0
- data/sig/mindee/v2/parsing/search/pagination_metadata.rbs +20 -0
- data/sig/mindee/v2/parsing/search/search_model.rbs +19 -0
- data/sig/mindee/v2/parsing/search/search_response.rbs +17 -0
- data/sig/mindee/v2/parsing/search_models.rbs +14 -0
- data/sig/mindee/v2/product/base_product.rbs +19 -0
- data/sig/mindee/v2/product/classification/classification.rbs +10 -0
- data/sig/mindee/v2/product/classification/classification_classifier.rbs +15 -0
- data/sig/mindee/v2/product/classification/classification_inference.rbs +15 -0
- data/sig/mindee/v2/product/classification/classification_response.rbs +23 -0
- data/sig/mindee/v2/product/classification/classification_result.rbs +15 -0
- data/sig/mindee/v2/product/classification/params/classification_parameters/classification_parameters.rbs +23 -0
- data/sig/mindee/v2/product/crop/crop.rbs +10 -0
- data/sig/mindee/v2/product/crop/crop_inference.rbs +14 -0
- data/sig/mindee/v2/product/crop/crop_item.rbs +18 -0
- data/sig/mindee/v2/product/crop/crop_response.rbs +25 -0
- data/sig/mindee/v2/product/crop/crop_result.rbs +14 -0
- data/sig/mindee/v2/product/crop/params/crop_parameters/crop_parameters.rbs +23 -0
- data/sig/mindee/v2/product/extraction/extraction.rbs +15 -0
- data/sig/mindee/v2/product/extraction/extraction_inference.rbs +19 -0
- data/sig/mindee/v2/product/extraction/extraction_response.rbs +24 -0
- data/sig/mindee/v2/product/extraction/extraction_result.rbs +18 -0
- data/sig/mindee/v2/product/extraction/params/data_schema.rbs +21 -0
- data/sig/mindee/v2/product/extraction/params/data_schema_field.rbs +29 -0
- data/sig/mindee/v2/product/extraction/params/data_schema_replace.rbs +21 -0
- data/sig/mindee/v2/product/extraction/params/extraction_parameters.rbs +38 -0
- data/sig/mindee/v2/product/ocr/ocr.rbs +10 -0
- data/sig/mindee/v2/product/ocr/ocr_inference.rbs +14 -0
- data/sig/mindee/v2/product/ocr/ocr_page.rbs +15 -0
- data/sig/mindee/v2/product/ocr/ocr_response.rbs +23 -0
- data/sig/mindee/v2/product/ocr/ocr_result.rbs +14 -0
- data/sig/mindee/v2/product/ocr/ocr_word.rbs +15 -0
- data/sig/mindee/v2/product/ocr/params/ocr_parameters/ocr_parameters.rbs +24 -0
- data/sig/mindee/v2/product/split/params/split_parameters/split_parameters.rbs +23 -0
- data/sig/mindee/v2/product/split/split.rbs +10 -0
- data/sig/mindee/v2/product/split/split_inference.rbs +14 -0
- data/sig/mindee/v2/product/split/split_range.rbs +18 -0
- data/sig/mindee/v2/product/split/split_response.rbs +25 -0
- data/sig/mindee/v2/product/split/split_result.rbs +14 -0
- data/sig/mindee/version.rbs +6 -0
- data/sig/mindee.rbs +62 -0
- metadata +600 -0
data/bin/v2/parser.rb
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'mindee'
|
|
4
|
+
require_relative 'products'
|
|
5
|
+
|
|
6
|
+
module MindeeCLI
|
|
7
|
+
# Mindee Command Line Interface
|
|
8
|
+
# V2 CLI class.
|
|
9
|
+
class V2Parser
|
|
10
|
+
# @return [Array<String>]
|
|
11
|
+
attr_reader :arguments
|
|
12
|
+
|
|
13
|
+
# @return [OptionParser]
|
|
14
|
+
attr_reader :options_parser
|
|
15
|
+
|
|
16
|
+
# @return [Parser]
|
|
17
|
+
attr_reader :product_parser
|
|
18
|
+
|
|
19
|
+
# @return [Parser]
|
|
20
|
+
attr_reader :search_parser
|
|
21
|
+
|
|
22
|
+
def initialize(arguments)
|
|
23
|
+
@arguments = arguments
|
|
24
|
+
@options_parser = OptionParser.new do |opts|
|
|
25
|
+
opts.banner = 'Usage: mindee v2 command [options]'
|
|
26
|
+
end
|
|
27
|
+
@product_parser = init_product_parser
|
|
28
|
+
@search_parser = init_search_parser
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Summarize and print the result of the command.
|
|
32
|
+
# @param command [String]
|
|
33
|
+
def print_result(command)
|
|
34
|
+
if command == 'search-models'
|
|
35
|
+
@search_parser.parse!(@arguments)
|
|
36
|
+
result = search(@options)
|
|
37
|
+
summarized_result = output_format == :full ? result.to_s : result.models.to_s
|
|
38
|
+
else
|
|
39
|
+
@product_parser[command].parse!(@arguments)
|
|
40
|
+
@options[:file_path] = @arguments.shift
|
|
41
|
+
if @options[:file_path].nil?
|
|
42
|
+
warn 'file missing'
|
|
43
|
+
abort(@product_parser[command].help)
|
|
44
|
+
end
|
|
45
|
+
result = send(command, @options)
|
|
46
|
+
summarized_result = output_format == :full ? result.inference.to_s : result.inference.result.to_s
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
if output_format == :raw
|
|
50
|
+
puts JSON.pretty_generate(raw_payload(result.raw_http))
|
|
51
|
+
else
|
|
52
|
+
puts summarized_result
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Executes the command.
|
|
57
|
+
# @return [void]
|
|
58
|
+
def execute
|
|
59
|
+
@options = { output_format: :summary }
|
|
60
|
+
command = @arguments.shift
|
|
61
|
+
|
|
62
|
+
validate_command!(command)
|
|
63
|
+
print_result(command)
|
|
64
|
+
rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e
|
|
65
|
+
if command == 'search-models'
|
|
66
|
+
abort("#{e.message}\n\n#{@search_parser.help}")
|
|
67
|
+
else
|
|
68
|
+
abort("#{e.message}\n\n#{@product_parser[command].help}")
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
private
|
|
73
|
+
|
|
74
|
+
def validate_command!(command)
|
|
75
|
+
return if V2_PRODUCTS.include?(command) || command == 'search-models'
|
|
76
|
+
|
|
77
|
+
error_msg = "#{@options_parser.help}\nAvailable commands:\n"
|
|
78
|
+
error_msg += " #{'search-models'.ljust(50)}Search for available models for this API key\n"
|
|
79
|
+
|
|
80
|
+
V2_PRODUCTS.each do |product_key, product_values|
|
|
81
|
+
error_msg += " #{product_key.to_s.ljust(50)}#{product_values[:description]}\n"
|
|
82
|
+
end
|
|
83
|
+
abort(error_msg)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def init_search_parser
|
|
87
|
+
OptionParser.new do |options_parser|
|
|
88
|
+
options_parser.banner = 'Usage: mindee v2 search-models [options]'
|
|
89
|
+
init_common_options(options_parser)
|
|
90
|
+
options_parser.on('-n [NAME]', '--name [NAME]',
|
|
91
|
+
'Search for partial matches in model name. Note: case insensitive') do |v|
|
|
92
|
+
@options[:model_name] = v
|
|
93
|
+
end
|
|
94
|
+
options_parser.on('-t [NAME]', '--type [NAME]',
|
|
95
|
+
'Search for EXACT matches in model type. Note: case sensitive') do |v|
|
|
96
|
+
@options[:model_type] = v
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def setup_specific_options(options_parser, doc_value)
|
|
102
|
+
options_parser.on('-r', '--rag', 'Enable RAG') { @options[:rag] = true } if doc_value.key?(:rag)
|
|
103
|
+
if doc_value.key?(:raw_text)
|
|
104
|
+
options_parser.on('-R', '--raw-text', 'Enable Raw Text retrieval') do
|
|
105
|
+
@options[:raw_text] = true
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
if doc_value.key?(:confidence)
|
|
109
|
+
options_parser.on('-c', '--confidence', 'Enable confidence scores') do
|
|
110
|
+
@options[:confidence] = true
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
options_parser.on('-p', '--polygon', 'Enable polygons') { @options[:polygon] = true } if doc_value.key?(:polygon)
|
|
114
|
+
if doc_value.key?(:text_context)
|
|
115
|
+
options_parser.on('-t [TEXT CONTEXT]', '--text-context [TEXT CONTEXT]', 'Add Text Context') do |v|
|
|
116
|
+
@options[:text_context] = v
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
return unless doc_value.key?(:data_schema)
|
|
120
|
+
|
|
121
|
+
options_parser.on('-d [DATA SCHEMA]', '--data-schema [DATA SCHEMA]', 'Add Data Schema') do |v|
|
|
122
|
+
@options[:data_schema] = v
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Initialize common options for search and product commands.
|
|
127
|
+
# @param options_parser [OptionParser]
|
|
128
|
+
def init_common_options(options_parser)
|
|
129
|
+
options_parser.on('-k [KEY]', '--key [KEY]', 'API key for the endpoint') { |v| @options[:api_key] = v }
|
|
130
|
+
options_parser.on('-o FORMAT', '--output-format FORMAT', ['raw', 'full', 'summary'],
|
|
131
|
+
'Format of the output (raw, full, summary). Default: summary') do |format|
|
|
132
|
+
@options[:output_format] = format
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# @return [Symbol]
|
|
137
|
+
def output_format
|
|
138
|
+
@options[:output_format]&.to_sym || :summary
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Handles JSON payloads represented either as a string or an already-parsed hash.
|
|
142
|
+
# Also tolerates one extra JSON encoding layer.
|
|
143
|
+
# @param payload [String, Hash]
|
|
144
|
+
# @return [Hash, Array, String]
|
|
145
|
+
def raw_payload(payload)
|
|
146
|
+
parsed_payload = payload
|
|
147
|
+
2.times do
|
|
148
|
+
break unless parsed_payload.is_a?(String)
|
|
149
|
+
|
|
150
|
+
parsed_payload = JSON.parse(parsed_payload)
|
|
151
|
+
rescue JSON::ParserError
|
|
152
|
+
break
|
|
153
|
+
end
|
|
154
|
+
parsed_payload
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# @return [Hash]
|
|
158
|
+
def init_product_parser
|
|
159
|
+
v2_product_parser = {}
|
|
160
|
+
V2_PRODUCTS.each do |product_key, product_values|
|
|
161
|
+
v2_product_parser[product_key] = OptionParser.new do |options_parser|
|
|
162
|
+
options_parser.banner = "Usage: mindee v2 #{product_key} [options] file"
|
|
163
|
+
options_parser.on('-m MODEL_ID', '--model-id MODEL_ID', 'Model ID') { |v| @options[:model_id] = v }
|
|
164
|
+
options_parser.on('-a ALIAS', '--alias ALIAS', 'Add a file alias to the response') do |v|
|
|
165
|
+
@options[:alias] = v
|
|
166
|
+
end
|
|
167
|
+
init_common_options(options_parser)
|
|
168
|
+
options_parser.on('-F', '--fix-pdf', 'Attempt to repair PDF before enqueueing') do
|
|
169
|
+
@options[:repair_pdf] = true
|
|
170
|
+
end
|
|
171
|
+
setup_specific_options(options_parser, product_values)
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
v2_product_parser
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# @return [Hash]
|
|
178
|
+
def setup_product_params
|
|
179
|
+
params = { model_id: @options[:model_id] }
|
|
180
|
+
@options.each_pair do |key, value|
|
|
181
|
+
params[key] = value if V2_PRODUCTS['extraction'].include?(key)
|
|
182
|
+
end
|
|
183
|
+
params
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# @param product_command [String]
|
|
187
|
+
# @param options [Hash]
|
|
188
|
+
# @return [Mindee::V1::Parsing::Common::ApiResponse]
|
|
189
|
+
def send(product_command, options)
|
|
190
|
+
mindee_client = Mindee::V2::Client.new(api_key: options[:api_key])
|
|
191
|
+
response_class = V2_PRODUCTS[product_command][:response_class]
|
|
192
|
+
input_source = setup_input_source(options)
|
|
193
|
+
params = setup_product_params
|
|
194
|
+
|
|
195
|
+
mindee_client.enqueue_and_get_result(
|
|
196
|
+
response_class,
|
|
197
|
+
input_source,
|
|
198
|
+
params
|
|
199
|
+
)
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# @param options [Hash]
|
|
203
|
+
# @return [Mindee::V2::Parsing::Search::SearchResponse]
|
|
204
|
+
def search(options)
|
|
205
|
+
mindee_client = Mindee::V2::Client.new(api_key: options[:api_key])
|
|
206
|
+
mindee_client.search_models(options[:model_name], options[:model_type])
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# @param options [Hash]
|
|
210
|
+
# @return [Mindee::Input::InputSource]
|
|
211
|
+
def setup_input_source(options)
|
|
212
|
+
if options[:file_path].start_with?('https://')
|
|
213
|
+
Mindee::Input::Source::URLInputSource.new(options[:file_path])
|
|
214
|
+
else
|
|
215
|
+
Mindee::Input::Source::PathInputSource.new(options[:file_path], repair_pdf: options[:repair_pdf])
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# @param options [Hash]
|
|
220
|
+
# @return [Hash, nil]
|
|
221
|
+
def setup_page_options(options)
|
|
222
|
+
if options[:cut_pages].nil? || !options[:cut_pages].is_a?(Integer) ||
|
|
223
|
+
options[:cut_pages].negative?
|
|
224
|
+
nil
|
|
225
|
+
else
|
|
226
|
+
|
|
227
|
+
{
|
|
228
|
+
page_indexes: (0..options[:cut_pages].to_i).to_a,
|
|
229
|
+
operation: :KEEP_ONLY,
|
|
230
|
+
on_min_pages: 0,
|
|
231
|
+
}
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
end
|
data/bin/v2/products.rb
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'mindee/v2/product'
|
|
4
|
+
|
|
5
|
+
# NOTE: keep product names as string instead of symbols due to kebab-case.
|
|
6
|
+
|
|
7
|
+
V2_PRODUCTS = {
|
|
8
|
+
'classification' => {
|
|
9
|
+
description: 'Classification Utility',
|
|
10
|
+
response_class: Mindee::V2::Product::Classification::Classification,
|
|
11
|
+
},
|
|
12
|
+
'extraction' => {
|
|
13
|
+
description: 'Extraction Inference',
|
|
14
|
+
response_class: Mindee::V2::Product::Extraction::Extraction,
|
|
15
|
+
rag: true,
|
|
16
|
+
polygon: true,
|
|
17
|
+
confidence: true,
|
|
18
|
+
raw_text: true,
|
|
19
|
+
text_context: true,
|
|
20
|
+
data_schema: true,
|
|
21
|
+
},
|
|
22
|
+
'crop' => {
|
|
23
|
+
description: 'Crop Utility',
|
|
24
|
+
response_class: Mindee::V2::Product::Crop::Crop,
|
|
25
|
+
},
|
|
26
|
+
'ocr' => {
|
|
27
|
+
description: 'OCR Utility',
|
|
28
|
+
response_class: Mindee::V2::Product::OCR::OCR,
|
|
29
|
+
},
|
|
30
|
+
'split' => {
|
|
31
|
+
description: 'Split Utility',
|
|
32
|
+
response_class: Mindee::V2::Product::Split::Split,
|
|
33
|
+
},
|
|
34
|
+
}.freeze
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Install the Ruby client library by running:
|
|
3
|
+
# gem install mindee
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'mindee'
|
|
7
|
+
|
|
8
|
+
# Init a new client
|
|
9
|
+
mindee_client = Mindee::V1::Client.new(api_key: 'my-api-key')
|
|
10
|
+
|
|
11
|
+
# Load a file from disk
|
|
12
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
13
|
+
|
|
14
|
+
# Parse the file
|
|
15
|
+
result = mindee_client.parse(
|
|
16
|
+
input_source,
|
|
17
|
+
Mindee::V1::Product::FR::BankAccountDetails::BankAccountDetailsV1
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Print a full summary of the parsed data in RST format
|
|
21
|
+
puts result.document
|
|
22
|
+
|
|
23
|
+
# Print the document-level parsed data
|
|
24
|
+
# puts result.document.inference.prediction
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Install the Ruby client library by running:
|
|
3
|
+
# gem install mindee
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'mindee'
|
|
7
|
+
|
|
8
|
+
# Init a new client
|
|
9
|
+
mindee_client = Mindee::V1::Client.new(api_key: 'my-api-key')
|
|
10
|
+
|
|
11
|
+
# Load a file from disk
|
|
12
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
13
|
+
|
|
14
|
+
# Parse the file
|
|
15
|
+
result = mindee_client.parse(
|
|
16
|
+
input_source,
|
|
17
|
+
Mindee::V1::Product::FR::BankAccountDetails::BankAccountDetailsV2
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Print a full summary of the parsed data in RST format
|
|
21
|
+
puts result.document
|
|
22
|
+
|
|
23
|
+
# Print the document-level parsed data
|
|
24
|
+
# puts result.document.inference.prediction
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Install the Ruby client library by running:
|
|
3
|
+
# gem install mindee
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'mindee'
|
|
7
|
+
|
|
8
|
+
# Init a new client
|
|
9
|
+
mindee_client = Mindee::V1::Client.new(api_key: 'my-api-key')
|
|
10
|
+
|
|
11
|
+
# Load a file from disk
|
|
12
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
13
|
+
|
|
14
|
+
# Parse the file
|
|
15
|
+
result = mindee_client.parse(
|
|
16
|
+
input_source,
|
|
17
|
+
Mindee::V1::Product::FR::BankStatement::BankStatementV2
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Print a full summary of the parsed data in RST format
|
|
21
|
+
puts result.document
|
|
22
|
+
|
|
23
|
+
# Print the document-level parsed data
|
|
24
|
+
# puts result.document.inference.prediction
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Install the Ruby client library by running:
|
|
3
|
+
# gem install mindee
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'mindee'
|
|
7
|
+
|
|
8
|
+
# Init a new client
|
|
9
|
+
mindee_client = Mindee::V1::Client.new(api_key: 'my-api-key')
|
|
10
|
+
|
|
11
|
+
# Load a file from disk
|
|
12
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
13
|
+
|
|
14
|
+
# Parse the file
|
|
15
|
+
result = mindee_client.parse(
|
|
16
|
+
input_source,
|
|
17
|
+
Mindee::V1::Product::BarcodeReader::BarcodeReaderV1
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Print a full summary of the parsed data in RST format
|
|
21
|
+
puts result.document
|
|
22
|
+
|
|
23
|
+
# Print the document-level parsed data
|
|
24
|
+
# puts result.document.inference.prediction
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Install the Ruby client library by running:
|
|
3
|
+
# gem install mindee
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'mindee'
|
|
7
|
+
|
|
8
|
+
# Init a new client
|
|
9
|
+
mindee_client = Mindee::V1::Client.new(api_key: 'my-api-key')
|
|
10
|
+
|
|
11
|
+
# Load a file from disk
|
|
12
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
13
|
+
|
|
14
|
+
# Parse the file
|
|
15
|
+
result = mindee_client.parse(
|
|
16
|
+
input_source,
|
|
17
|
+
Mindee::V1::Product::Cropper::CropperV1
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Print a full summary of the parsed data in RST format
|
|
21
|
+
puts result.document
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Install the Ruby client library by running:
|
|
3
|
+
# gem install mindee
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'mindee'
|
|
7
|
+
|
|
8
|
+
# Init a new client
|
|
9
|
+
mindee_client = Mindee::V1::Client.new(api_key: 'my-api-key')
|
|
10
|
+
|
|
11
|
+
# Load a file from disk
|
|
12
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
13
|
+
|
|
14
|
+
# Initialize a custom endpoint for this product
|
|
15
|
+
custom_endpoint = mindee_client.create_endpoint(
|
|
16
|
+
account_name: 'my-account',
|
|
17
|
+
endpoint_name: 'my-endpoint',
|
|
18
|
+
version: 'my-version'
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
# Parse the file
|
|
22
|
+
result = mindee_client.parse(
|
|
23
|
+
input_source,
|
|
24
|
+
Mindee::V1::Product::Universal::Universal,
|
|
25
|
+
endpoint: custom_endpoint,
|
|
26
|
+
enqueue: false
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Print a full summary of the parsed data in RST format
|
|
30
|
+
puts result.document
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Install the Ruby client library by running:
|
|
3
|
+
# gem install mindee
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'mindee'
|
|
7
|
+
|
|
8
|
+
# Init a new client
|
|
9
|
+
mindee_client = Mindee::V1::Client.new(api_key: 'my-api-key')
|
|
10
|
+
|
|
11
|
+
# Load a file from disk
|
|
12
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
13
|
+
|
|
14
|
+
# Initialize a custom endpoint for this product
|
|
15
|
+
custom_endpoint = mindee_client.create_endpoint(
|
|
16
|
+
account_name: 'my-account',
|
|
17
|
+
endpoint_name: 'my-endpoint',
|
|
18
|
+
version: 'my-version'
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
# Parse the file
|
|
22
|
+
result = mindee_client.parse(
|
|
23
|
+
input_source,
|
|
24
|
+
Mindee::V1::Product::Universal::Universal,
|
|
25
|
+
endpoint: custom_endpoint
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# Print a full summary of the parsed data in RST format
|
|
29
|
+
puts result.document
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Install the Ruby client library by running:
|
|
3
|
+
# gem install mindee
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'mindee'
|
|
7
|
+
|
|
8
|
+
# Init a new client
|
|
9
|
+
mindee_client = Mindee::V1::Client.new(api_key: 'my-api-key')
|
|
10
|
+
|
|
11
|
+
# Load a file from disk
|
|
12
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
13
|
+
|
|
14
|
+
# Parse the file
|
|
15
|
+
result = mindee_client.parse(
|
|
16
|
+
input_source,
|
|
17
|
+
Mindee::V1::Product::Receipt::ReceiptV5,
|
|
18
|
+
enqueue: false
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
# Print a full summary of the parsed data in RST format
|
|
22
|
+
puts result.document
|
|
23
|
+
|
|
24
|
+
# Print the document-level parsed data
|
|
25
|
+
# puts result.document.inference.prediction
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Install the Ruby client library by running:
|
|
3
|
+
# gem install mindee
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'mindee'
|
|
7
|
+
|
|
8
|
+
# Init a new client
|
|
9
|
+
mindee_client = Mindee::V1::Client.new(api_key: 'my-api-key')
|
|
10
|
+
|
|
11
|
+
# Load a file from disk
|
|
12
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
13
|
+
|
|
14
|
+
# Parse the file
|
|
15
|
+
result = mindee_client.parse(
|
|
16
|
+
input_source,
|
|
17
|
+
Mindee::V1::Product::Receipt::ReceiptV5
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Print a full summary of the parsed data in RST format
|
|
21
|
+
puts result.document
|
|
22
|
+
|
|
23
|
+
# Print the document-level parsed data
|
|
24
|
+
# puts result.document.inference.prediction
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Install the Ruby client library by running:
|
|
3
|
+
# gem install mindee
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'mindee'
|
|
7
|
+
|
|
8
|
+
# Init a new client
|
|
9
|
+
mindee_client = Mindee::V1::Client.new(api_key: 'my-api-key')
|
|
10
|
+
|
|
11
|
+
# Load a file from disk
|
|
12
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
13
|
+
|
|
14
|
+
# Parse the file
|
|
15
|
+
result = mindee_client.parse(
|
|
16
|
+
input_source,
|
|
17
|
+
Mindee::V1::Product::FinancialDocument::FinancialDocumentV1,
|
|
18
|
+
enqueue: false
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
# Print a full summary of the parsed data in RST format
|
|
22
|
+
puts result.document
|
|
23
|
+
|
|
24
|
+
# Print the document-level parsed data
|
|
25
|
+
# puts result.document.inference.prediction
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Install the Ruby client library by running:
|
|
3
|
+
# gem install mindee
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'mindee'
|
|
7
|
+
|
|
8
|
+
# Init a new client
|
|
9
|
+
mindee_client = Mindee::V1::Client.new(api_key: 'my-api-key')
|
|
10
|
+
|
|
11
|
+
# Load a file from disk
|
|
12
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
13
|
+
|
|
14
|
+
# Parse the file
|
|
15
|
+
result = mindee_client.parse(
|
|
16
|
+
input_source,
|
|
17
|
+
Mindee::V1::Product::FinancialDocument::FinancialDocumentV1
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Print a full summary of the parsed data in RST format
|
|
21
|
+
puts result.document
|
|
22
|
+
|
|
23
|
+
# Print the document-level parsed data
|
|
24
|
+
# puts result.document.inference.prediction
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Install the Ruby client library by running:
|
|
3
|
+
# gem install mindee
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'mindee'
|
|
7
|
+
|
|
8
|
+
# Init a new client
|
|
9
|
+
mindee_client = Mindee::V1::Client.new(api_key: 'my-api-key')
|
|
10
|
+
|
|
11
|
+
# Load a file from disk
|
|
12
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
13
|
+
|
|
14
|
+
# Parse the file
|
|
15
|
+
result = mindee_client.parse(
|
|
16
|
+
input_source,
|
|
17
|
+
Mindee::V1::Product::FR::IdCard::IdCardV1
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Print a full summary of the parsed data in RST format
|
|
21
|
+
puts result.document
|
|
22
|
+
|
|
23
|
+
# Print the document-level parsed data
|
|
24
|
+
# puts result.document.inference.prediction
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Install the Ruby client library by running:
|
|
3
|
+
# gem install mindee
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'mindee'
|
|
7
|
+
|
|
8
|
+
# Init a new client
|
|
9
|
+
mindee_client = Mindee::V1::Client.new(api_key: 'my-api-key')
|
|
10
|
+
|
|
11
|
+
# Load a file from disk
|
|
12
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
13
|
+
|
|
14
|
+
# Parse the file
|
|
15
|
+
result = mindee_client.parse(
|
|
16
|
+
input_source,
|
|
17
|
+
Mindee::V1::Product::FR::IdCard::IdCardV2
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Print a full summary of the parsed data in RST format
|
|
21
|
+
puts result.document
|
|
22
|
+
|
|
23
|
+
# Print the document-level parsed data
|
|
24
|
+
# puts result.document.inference.prediction
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Install the Ruby client library by running:
|
|
3
|
+
# gem install mindee
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'mindee'
|
|
7
|
+
|
|
8
|
+
# Init a new client
|
|
9
|
+
mindee_client = Mindee::V1::Client.new(api_key: 'my-api-key')
|
|
10
|
+
|
|
11
|
+
# Load a file from disk
|
|
12
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
13
|
+
|
|
14
|
+
# Parse the file
|
|
15
|
+
result = mindee_client.parse(
|
|
16
|
+
input_source,
|
|
17
|
+
Mindee::V1::Product::InternationalId::InternationalIdV2
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Print a full summary of the parsed data in RST format
|
|
21
|
+
puts result.document
|
|
22
|
+
|
|
23
|
+
# Print the document-level parsed data
|
|
24
|
+
# puts result.document.inference.prediction
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Install the Ruby client library by running:
|
|
3
|
+
# gem install mindee
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'mindee'
|
|
7
|
+
|
|
8
|
+
# Init a new client
|
|
9
|
+
mindee_client = Mindee::V1::Client.new(api_key: 'my-api-key')
|
|
10
|
+
|
|
11
|
+
# Load a file from disk
|
|
12
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
13
|
+
|
|
14
|
+
# Parse the file
|
|
15
|
+
result = mindee_client.parse(
|
|
16
|
+
input_source,
|
|
17
|
+
Mindee::V1::Product::InvoiceSplitter::InvoiceSplitterV1
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Print a full summary of the parsed data in RST format
|
|
21
|
+
puts result.document
|
|
22
|
+
|
|
23
|
+
# Print the document-level parsed data
|
|
24
|
+
# puts result.document.inference.prediction
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Install the Ruby client library by running:
|
|
3
|
+
# gem install mindee
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'mindee'
|
|
7
|
+
|
|
8
|
+
# Init a new client
|
|
9
|
+
mindee_client = Mindee::V1::Client.new(api_key: 'my-api-key')
|
|
10
|
+
|
|
11
|
+
# Load a file from disk
|
|
12
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
13
|
+
|
|
14
|
+
# Parse the file
|
|
15
|
+
result = mindee_client.parse(
|
|
16
|
+
input_source,
|
|
17
|
+
Mindee::V1::Product::Invoice::InvoiceV4,
|
|
18
|
+
enqueue: false
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
# Print a full summary of the parsed data in RST format
|
|
22
|
+
puts result.document
|
|
23
|
+
|
|
24
|
+
# Print the document-level parsed data
|
|
25
|
+
# puts result.document.inference.prediction
|