mindee 3.12.0 → 3.14.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.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/CHANGELOG.md +26 -0
  4. data/README.md +23 -23
  5. data/Rakefile +5 -0
  6. data/docs/bank_account_details_v2.md +5 -1
  7. data/docs/bank_check_v1.md +6 -2
  8. data/docs/bank_statement_fr_v1.md +3 -0
  9. data/docs/barcode_reader_v1.md +5 -1
  10. data/docs/bill_of_lading_v1.md +251 -0
  11. data/docs/carte_grise_v1.md +5 -1
  12. data/docs/carte_vitale_v1.md +5 -1
  13. data/docs/code_samples/bill_of_lading_v1_async.txt +19 -0
  14. data/docs/code_samples/energy_bill_fra_v1_async.txt +19 -0
  15. data/docs/code_samples/invoices_v4_async.txt +19 -0
  16. data/docs/code_samples/nutrition_facts_v1_async.txt +19 -0
  17. data/docs/code_samples/payslip_fra_v2_async.txt +19 -0
  18. data/docs/cropper_v1.md +6 -2
  19. data/docs/custom_v1.md +5 -3
  20. data/docs/energy_bill_fra_v1.md +309 -0
  21. data/docs/eu_driver_license_v1.md +6 -2
  22. data/docs/expense_receipts_v5.md +30 -5
  23. data/docs/financial_document_v1.md +43 -1
  24. data/docs/generated_v1.md +3 -0
  25. data/docs/getting_started.md +3 -0
  26. data/docs/idcard_fr_v2.md +15 -2
  27. data/docs/international_id_v2.md +13 -1
  28. data/docs/invoice_splitter_v1.md +16 -13
  29. data/docs/invoices_v4.md +70 -23
  30. data/docs/license_plates_v1.md +5 -1
  31. data/docs/multi_receipts_detector_v1.md +5 -1
  32. data/docs/nutrition_facts_v1.md +374 -0
  33. data/docs/passport_v1.md +5 -1
  34. data/docs/payslip_fra_v2.md +294 -0
  35. data/docs/proof_of_address_v1.md +5 -1
  36. data/docs/resume_v1.md +24 -1
  37. data/docs/us_driver_license_v1.md +6 -2
  38. data/docs/us_healthcare_cards_v1.md +5 -1
  39. data/docs/us_mail_v2.md +6 -2
  40. data/docs/us_w9_v1.md +6 -2
  41. data/examples/auto_invoice_splitter_extraction.rb +48 -0
  42. data/examples/auto_multi_receipts_detector_extraction.rb +31 -0
  43. data/lib/mindee/client.rb +20 -8
  44. data/lib/mindee/{image_extraction → extraction}/common/extracted_image.rb +1 -1
  45. data/lib/mindee/extraction/common/image_extractor.rb +192 -0
  46. data/lib/mindee/{image_extraction → extraction}/common.rb +1 -0
  47. data/lib/mindee/extraction/multi_receipts_extractor/multi_receipts_extractor.rb +32 -0
  48. data/lib/mindee/extraction/pdf_extractor/extracted_pdf.rb +55 -0
  49. data/lib/mindee/extraction/pdf_extractor/pdf_extractor.rb +111 -0
  50. data/lib/mindee/extraction/pdf_extractor.rb +4 -0
  51. data/lib/mindee/extraction/tax_extractor/tax_extractor.rb +322 -0
  52. data/lib/mindee/extraction/tax_extractor.rb +1 -320
  53. data/lib/mindee/extraction.rb +3 -0
  54. data/lib/mindee/http/endpoint.rb +18 -6
  55. data/lib/mindee/parsing/common/api_response.rb +1 -1
  56. data/lib/mindee/parsing/common/document.rb +31 -1
  57. data/lib/mindee/parsing/common/extras/cropper_extra.rb +29 -0
  58. data/lib/mindee/parsing/common/extras/extras.rb +50 -0
  59. data/lib/mindee/parsing/common/extras/full_text_ocr_extra.rb +32 -0
  60. data/lib/mindee/parsing/common/extras.rb +5 -0
  61. data/lib/mindee/parsing/common/page.rb +5 -0
  62. data/lib/mindee/parsing/standard/base_field.rb +1 -0
  63. data/lib/mindee/parsing/standard/date_field.rb +4 -0
  64. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1.rb +39 -0
  65. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rb +52 -0
  66. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_item.rb +95 -0
  67. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_consignee.rb +58 -0
  68. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb +136 -0
  69. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_notify_party.rb +58 -0
  70. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_page.rb +32 -0
  71. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_shipper.rb +58 -0
  72. data/lib/mindee/product/financial_document/financial_document_v1_document.rb +11 -1
  73. data/lib/mindee/product/financial_document/financial_document_v1_line_item.rb +15 -1
  74. data/lib/mindee/product/financial_document/financial_document_v1_page.rb +1 -1
  75. data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_bban.rb +4 -15
  76. data/lib/mindee/product/fr/energy_bill/energy_bill_v1.rb +41 -0
  77. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb +235 -0
  78. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_consumer.rb +48 -0
  79. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_supplier.rb +48 -0
  80. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.rb +97 -0
  81. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.rb +54 -0
  82. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_page.rb +34 -0
  83. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb +97 -0
  84. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contribution.rb +97 -0
  85. data/lib/mindee/product/fr/payslip/payslip_v2.rb +41 -0
  86. data/lib/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rb +54 -0
  87. data/lib/mindee/product/fr/payslip/payslip_v2_document.rb +128 -0
  88. data/lib/mindee/product/fr/payslip/payslip_v2_employee.rb +78 -0
  89. data/lib/mindee/product/fr/payslip/payslip_v2_employer.rb +78 -0
  90. data/lib/mindee/product/fr/payslip/payslip_v2_employment.rb +72 -0
  91. data/lib/mindee/product/fr/payslip/payslip_v2_page.rb +34 -0
  92. data/lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb +100 -0
  93. data/lib/mindee/product/fr/payslip/payslip_v2_pay_period.rb +66 -0
  94. data/lib/mindee/product/fr/payslip/payslip_v2_pto.rb +56 -0
  95. data/lib/mindee/product/fr/payslip/payslip_v2_salary_detail.rb +81 -0
  96. data/lib/mindee/product/invoice/invoice_v4_document.rb +11 -1
  97. data/lib/mindee/product/invoice/invoice_v4_line_item.rb +15 -1
  98. data/lib/mindee/product/invoice/invoice_v4_page.rb +1 -1
  99. data/lib/mindee/product/invoice_splitter/invoice_splitter_v1_document.rb +1 -1
  100. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1.rb +39 -0
  101. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_added_sugar.rb +52 -0
  102. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_calorie.rb +52 -0
  103. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_cholesterol.rb +52 -0
  104. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_dietary_fiber.rb +52 -0
  105. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_document.rb +173 -0
  106. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrient.rb +87 -0
  107. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_page.rb +32 -0
  108. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_protein.rb +52 -0
  109. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_saturated_fat.rb +52 -0
  110. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_serving_size.rb +46 -0
  111. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_sodium.rb +58 -0
  112. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_carbohydrate.rb +52 -0
  113. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_fat.rb +52 -0
  114. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_sugar.rb +52 -0
  115. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_trans_fat.rb +52 -0
  116. data/lib/mindee/product/receipt/receipt_v5_line_item.rb +11 -1
  117. data/lib/mindee/product/resume/resume_v1_certificate.rb +11 -1
  118. data/lib/mindee/product/resume/resume_v1_education.rb +14 -1
  119. data/lib/mindee/product/resume/resume_v1_language.rb +9 -1
  120. data/lib/mindee/product/resume/resume_v1_professional_experience.rb +15 -1
  121. data/lib/mindee/product/resume/resume_v1_social_networks_url.rb +9 -1
  122. data/lib/mindee/product/us/healthcare_card/healthcare_card_v1_copay.rb +9 -1
  123. data/lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb +14 -1
  124. data/lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb +5 -17
  125. data/lib/mindee/product.rb +5 -1
  126. data/lib/mindee/version.rb +1 -1
  127. metadata +71 -9
  128. data/lib/mindee/image_extraction/common/image_extractor.rb +0 -191
  129. data/lib/mindee/image_extraction/multi_receipts_extractor/multi_receipts_extractor.rb +0 -26
  130. data/lib/mindee/image_extraction.rb +0 -4
  131. /data/lib/mindee/{image_extraction → extraction}/multi_receipts_extractor.rb +0 -0
  132. /data/lib/mindee/extraction/{ocr_extractor.rb → tax_extractor/ocr_extractor.rb} +0 -0
@@ -0,0 +1,294 @@
1
+ ---
2
+ title: FR Payslip OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-fr-payslip-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
6
+ ---
7
+ The Ruby OCR SDK supports the [Payslip API](https://platform.mindee.com/mindee/payslip_fra).
8
+
9
+ Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/payslip_fra/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK.
10
+ ![Payslip sample](https://github.com/mindee/client-lib-test-data/blob/main/products/payslip_fra/default_sample.jpg?raw=true)
11
+
12
+ # Quick-Start
13
+ ```rb
14
+ require 'mindee'
15
+
16
+ # Init a new client
17
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
18
+
19
+ # Load a file from disk
20
+ input_source = mindee_client.source_from_path('/path/to/the/file.ext')
21
+
22
+ # Parse the file
23
+ result = mindee_client.enqueue_and_parse(
24
+ input_source,
25
+ Mindee::Product::FR::Payslip::PayslipV2
26
+ )
27
+
28
+ # Print a full summary of the parsed data in RST format
29
+ puts result.document
30
+
31
+ # Print the document-level parsed data
32
+ # puts result.document.inference.prediction
33
+
34
+ ```
35
+
36
+ **Output (RST):**
37
+ ```rst
38
+ ########
39
+ Document
40
+ ########
41
+ :Mindee ID: 972edba5-25aa-49d0-8431-e2557ddd788e
42
+ :Filename: default_sample.jpg
43
+
44
+ Inference
45
+ #########
46
+ :Product: mindee/payslip_fra v2.0
47
+ :Rotation applied: No
48
+
49
+ Prediction
50
+ ==========
51
+ :Employee:
52
+ :Address: 52 RUE DES FLEURS 33500 LIBOURNE FRANCE
53
+ :Date of Birth:
54
+ :First Name: Jean Luc
55
+ :Last Name: Picard
56
+ :Phone Number:
57
+ :Registration Number:
58
+ :Social Security Number: 123456789012345
59
+ :Employer:
60
+ :Address: 1 RUE DU TONNOT 25210 DOUBS
61
+ :Company ID: 12345678901234
62
+ :Company Site:
63
+ :NAF Code: 1234A
64
+ :Name: DEMO COMPANY
65
+ :Phone Number:
66
+ :URSSAF Number:
67
+ :Bank Account Details:
68
+ :Bank Name:
69
+ :IBAN:
70
+ :SWIFT:
71
+ :Employment:
72
+ :Category: Cadre
73
+ :Coefficient: 600.00
74
+ :Collective Agreement: Construction -- Promotion
75
+ :Job Title: Directeur Régional du Développement
76
+ :Position Level:
77
+ :Start Date: 2022-05-01
78
+ :Salary Details:
79
+ +--------------+-----------+--------------------------------------+-----------+
80
+ | Amount | Base | Description | Rate |
81
+ +==============+===========+======================================+===========+
82
+ | 6666.67 | | Salaire de base | |
83
+ +--------------+-----------+--------------------------------------+-----------+
84
+ | 9.30 | | Part patronale Mutuelle NR | |
85
+ +--------------+-----------+--------------------------------------+-----------+
86
+ | 508.30 | | Avantages en nature voiture | |
87
+ +--------------+-----------+--------------------------------------+-----------+
88
+ :Pay Detail:
89
+ :Gross Salary: 7184.27
90
+ :Gross Salary YTD: 18074.81
91
+ :Income Tax Rate: 17.60
92
+ :Income Tax Withheld: 1030.99
93
+ :Net Paid: 3868.32
94
+ :Net Paid Before Tax: 4899.31
95
+ :Net Taxable: 5857.90
96
+ :Net Taxable YTD: 14752.73
97
+ :Total Cost Employer: 10486.94
98
+ :Total Taxes and Deductions: 1650.36
99
+ :PTO:
100
+ :Accrued This Period: 6.17
101
+ :Balance End of Period: 6.17
102
+ :Used This Period:
103
+ :Pay Period:
104
+ :End Date: 2023-03-31
105
+ :Month: 03
106
+ :Payment Date: 2023-03-29
107
+ :Start Date: 2023-03-01
108
+ :Year: 2023
109
+ ```
110
+
111
+ # Field Types
112
+ ## Standard Fields
113
+ These fields are generic and used in several products.
114
+
115
+ ### Basic Field
116
+ Each prediction object contains a set of fields that inherit from the generic `Field` class.
117
+ A typical `Field` object will have the following attributes:
118
+
119
+ * **value** (`String`, `Float`, `Integer`, `Boolean`): corresponds to the field value. Can be `nil` if no value was extracted.
120
+ * **confidence** (Float, nil): the confidence score of the field prediction.
121
+ * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
122
+ * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
123
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
124
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
125
+
126
+
127
+ Aside from the previous attributes, all basic fields have access to a `to_s` method that can be used to print their value as a string.
128
+
129
+ ## Specific Fields
130
+ Fields which are specific to this product; they are not used in any other product.
131
+
132
+ ### Bank Account Details Field
133
+ Information about the employee's bank account.
134
+
135
+ A `PayslipV2BankAccountDetail` implements the following attributes:
136
+
137
+ * `bank_name` (String): The name of the bank.
138
+ * `iban` (String): The IBAN of the bank account.
139
+ * `swift` (String): The SWIFT code of the bank.
140
+ Fields which are specific to this product; they are not used in any other product.
141
+
142
+ ### Employee Field
143
+ Information about the employee.
144
+
145
+ A `PayslipV2Employee` implements the following attributes:
146
+
147
+ * `address` (String): The address of the employee.
148
+ * `date_of_birth` (String): The date of birth of the employee.
149
+ * `first_name` (String): The first name of the employee.
150
+ * `last_name` (String): The last name of the employee.
151
+ * `phone_number` (String): The phone number of the employee.
152
+ * `registration_number` (String): The registration number of the employee.
153
+ * `social_security_number` (String): The social security number of the employee.
154
+ Fields which are specific to this product; they are not used in any other product.
155
+
156
+ ### Employer Field
157
+ Information about the employer.
158
+
159
+ A `PayslipV2Employer` implements the following attributes:
160
+
161
+ * `address` (String): The address of the employer.
162
+ * `company_id` (String): The company ID of the employer.
163
+ * `company_site` (String): The site of the company.
164
+ * `naf_code` (String): The NAF code of the employer.
165
+ * `name` (String): The name of the employer.
166
+ * `phone_number` (String): The phone number of the employer.
167
+ * `urssaf_number` (String): The URSSAF number of the employer.
168
+ Fields which are specific to this product; they are not used in any other product.
169
+
170
+ ### Employment Field
171
+ Information about the employment.
172
+
173
+ A `PayslipV2Employment` implements the following attributes:
174
+
175
+ * `category` (String): The category of the employment.
176
+ * `coefficient` (Float): The coefficient of the employment.
177
+ * `collective_agreement` (String): The collective agreement of the employment.
178
+ * `job_title` (String): The job title of the employee.
179
+ * `position_level` (String): The position level of the employment.
180
+ * `start_date` (String): The start date of the employment.
181
+ Fields which are specific to this product; they are not used in any other product.
182
+
183
+ ### Pay Detail Field
184
+ Detailed information about the pay.
185
+
186
+ A `PayslipV2PayDetail` implements the following attributes:
187
+
188
+ * `gross_salary` (Float): The gross salary of the employee.
189
+ * `gross_salary_ytd` (Float): The year-to-date gross salary of the employee.
190
+ * `income_tax_rate` (Float): The income tax rate of the employee.
191
+ * `income_tax_withheld` (Float): The income tax withheld from the employee's pay.
192
+ * `net_paid` (Float): The net paid amount of the employee.
193
+ * `net_paid_before_tax` (Float): The net paid amount before tax of the employee.
194
+ * `net_taxable` (Float): The net taxable amount of the employee.
195
+ * `net_taxable_ytd` (Float): The year-to-date net taxable amount of the employee.
196
+ * `total_cost_employer` (Float): The total cost to the employer.
197
+ * `total_taxes_and_deductions` (Float): The total taxes and deductions of the employee.
198
+ Fields which are specific to this product; they are not used in any other product.
199
+
200
+ ### Pay Period Field
201
+ Information about the pay period.
202
+
203
+ A `PayslipV2PayPeriod` implements the following attributes:
204
+
205
+ * `end_date` (String): The end date of the pay period.
206
+ * `month` (String): The month of the pay period.
207
+ * `payment_date` (String): The date of payment for the pay period.
208
+ * `start_date` (String): The start date of the pay period.
209
+ * `year` (String): The year of the pay period.
210
+ Fields which are specific to this product; they are not used in any other product.
211
+
212
+ ### PTO Field
213
+ Information about paid time off.
214
+
215
+ A `PayslipV2Pto` implements the following attributes:
216
+
217
+ * `accrued_this_period` (Float): The amount of paid time off accrued in this period.
218
+ * `balance_end_of_period` (Float): The balance of paid time off at the end of the period.
219
+ * `used_this_period` (Float): The amount of paid time off used in this period.
220
+ Fields which are specific to this product; they are not used in any other product.
221
+
222
+ ### Salary Details Field
223
+ Detailed information about the earnings.
224
+
225
+ A `PayslipV2SalaryDetail` implements the following attributes:
226
+
227
+ * `amount` (Float): The amount of the earnings.
228
+ * `base` (Float): The base value of the earnings.
229
+ * `description` (String): The description of the earnings.
230
+ * `rate` (Float): The rate of the earnings.
231
+
232
+ # Attributes
233
+ The following fields are extracted for Payslip V2:
234
+
235
+ ## Bank Account Details
236
+ **bank_account_details** ([PayslipV2BankAccountDetail](#bank-account-details-field)): Information about the employee's bank account.
237
+
238
+ ```rb
239
+ puts result.document.inference.prediction.bank_account_details.value
240
+ ```
241
+
242
+ ## Employee
243
+ **employee** ([PayslipV2Employee](#employee-field)): Information about the employee.
244
+
245
+ ```rb
246
+ puts result.document.inference.prediction.employee.value
247
+ ```
248
+
249
+ ## Employer
250
+ **employer** ([PayslipV2Employer](#employer-field)): Information about the employer.
251
+
252
+ ```rb
253
+ puts result.document.inference.prediction.employer.value
254
+ ```
255
+
256
+ ## Employment
257
+ **employment** ([PayslipV2Employment](#employment-field)): Information about the employment.
258
+
259
+ ```rb
260
+ puts result.document.inference.prediction.employment.value
261
+ ```
262
+
263
+ ## Pay Detail
264
+ **pay_detail** ([PayslipV2PayDetail](#pay-detail-field)): Detailed information about the pay.
265
+
266
+ ```rb
267
+ puts result.document.inference.prediction.pay_detail.value
268
+ ```
269
+
270
+ ## Pay Period
271
+ **pay_period** ([PayslipV2PayPeriod](#pay-period-field)): Information about the pay period.
272
+
273
+ ```rb
274
+ puts result.document.inference.prediction.pay_period.value
275
+ ```
276
+
277
+ ## PTO
278
+ **pto** ([PayslipV2Pto](#pto-field)): Information about paid time off.
279
+
280
+ ```rb
281
+ puts result.document.inference.prediction.pto.value
282
+ ```
283
+
284
+ ## Salary Details
285
+ **salary_details** (Array<[PayslipV2SalaryDetail](#salary-details-field)>): Detailed information about the earnings.
286
+
287
+ ```rb
288
+ for salary_details_elem in result.document.inference.prediction.salary_details do
289
+ puts salary_details_elem.value
290
+ end
291
+ ```
292
+
293
+ # Questions?
294
+ [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  title: Proof of Address OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-proof-of-address-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
3
6
  ---
4
7
  The Ruby OCR SDK supports the [Proof of Address API](https://platform.mindee.com/mindee/proof_of_address).
5
8
 
@@ -27,6 +30,7 @@ puts result.document
27
30
 
28
31
  # Print the document-level parsed data
29
32
  # puts result.document.inference.prediction
33
+
30
34
  ```
31
35
 
32
36
  **Output (RST):**
@@ -104,7 +108,7 @@ A typical `Field` object will have the following attributes:
104
108
  * **confidence** (Float, nil): the confidence score of the field prediction.
105
109
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
106
110
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
107
- * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
111
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
108
112
  * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
109
113
 
110
114
 
data/docs/resume_v1.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  title: Resume OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-resume-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
3
6
  ---
4
7
  The Ruby OCR SDK supports the [Resume API](https://platform.mindee.com/mindee/resume).
5
8
 
@@ -27,6 +30,7 @@ puts result.document
27
30
 
28
31
  # Print the document-level parsed data
29
32
  # puts result.document.inference.prediction
33
+
30
34
  ```
31
35
 
32
36
  **Output (RST):**
@@ -115,7 +119,7 @@ A typical `Field` object will have the following attributes:
115
119
  * **confidence** (Float, nil): the confidence score of the field prediction.
116
120
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
117
121
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
118
- * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
122
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
119
123
  * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
120
124
 
121
125
 
@@ -165,6 +169,13 @@ A `ResumeV1Language` implements the following attributes:
165
169
 
166
170
  * `language` (String): The language's ISO 639 code.
167
171
  * `level` (String): The candidate's level for the language.
172
+
173
+ #### Possible values include:
174
+ - Fluent
175
+ - Proficient
176
+ - Intermediate
177
+ - Beginner
178
+
168
179
  Fields which are specific to this product; they are not used in any other product.
169
180
 
170
181
  ### Professional Experiences Field
@@ -173,6 +184,13 @@ The list of the candidate's professional experiences.
173
184
  A `ResumeV1ProfessionalExperience` implements the following attributes:
174
185
 
175
186
  * `contract_type` (String): The type of contract for the professional experience.
187
+
188
+ #### Possible values include:
189
+ - Full-Time
190
+ - Part-Time
191
+ - Internship
192
+ - Freelance
193
+
176
194
  * `department` (String): The specific department or division within the company.
177
195
  * `employer` (String): The name of the company or organization.
178
196
  * `end_month` (String): The month when the professional experience ended.
@@ -219,6 +237,11 @@ puts result.document.inference.prediction.document_language.value
219
237
  ## Document Type
220
238
  **document_type** ([ClassificationField](#classification-field)): The type of the document sent.
221
239
 
240
+ #### Possible values include:
241
+ - RESUME
242
+ - MOTIVATION_LETTER
243
+ - RECOMMENDATION_LETTER
244
+
222
245
  ```rb
223
246
  puts result.document.inference.prediction.document_type.value
224
247
  ```
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  title: US Driver License OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-us-driver-license-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
3
6
  ---
4
7
  The Ruby OCR SDK supports the [Driver License API](https://platform.mindee.com/mindee/us_driver_license).
5
8
 
@@ -27,6 +30,7 @@ puts result.document
27
30
 
28
31
  # Print the document-level parsed data
29
32
  # puts result.document.inference.prediction
33
+
30
34
  ```
31
35
 
32
36
  **Output (RST):**
@@ -100,7 +104,7 @@ A typical `Field` object will have the following attributes:
100
104
  * **confidence** (Float, nil): the confidence score of the field prediction.
101
105
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
102
106
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
103
- * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
107
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
104
108
  * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
105
109
 
106
110
 
@@ -122,7 +126,7 @@ The position field `PositionField` does not implement all the basic `Field` attr
122
126
  The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
123
127
 
124
128
  ## Page-Level Fields
125
- Some fields are constrained to the page level, and so will not be retrievable to through the document.
129
+ Some fields are constrained to the page level, and so will not be retrievable at document level.
126
130
 
127
131
  # Attributes
128
132
  The following fields are extracted for Driver License V1:
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  title: US Healthcare Card OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-us-healthcare-card-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
3
6
  ---
4
7
  The Ruby OCR SDK supports the [Healthcare Card API](https://platform.mindee.com/mindee/us_healthcare_cards).
5
8
 
@@ -27,6 +30,7 @@ puts result.document
27
30
 
28
31
  # Print the document-level parsed data
29
32
  # puts result.document.inference.prediction
33
+
30
34
  ```
31
35
 
32
36
  **Output (RST):**
@@ -84,7 +88,7 @@ A typical `Field` object will have the following attributes:
84
88
  * **confidence** (Float, nil): the confidence score of the field prediction.
85
89
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
86
90
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
87
- * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
91
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
88
92
  * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
89
93
 
90
94
 
data/docs/us_mail_v2.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  title: US US Mail OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-us-us-mail-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
3
6
  ---
4
7
  The Ruby OCR SDK supports the [US Mail API](https://platform.mindee.com/mindee/us_mail).
5
8
 
@@ -27,6 +30,7 @@ puts result.document
27
30
 
28
31
  # Print the document-level parsed data
29
32
  # puts result.document.inference.prediction
33
+
30
34
  ```
31
35
 
32
36
  **Output (RST):**
@@ -34,7 +38,7 @@ puts result.document
34
38
  :Sender Name: zed
35
39
  :Sender Address:
36
40
  :City: Dallas
37
- :Complete Address: 54321 Elm Street, Dallas, Texas ...
41
+ :Complete Address: 54321 Elm Street, Dallas, Texas 54321
38
42
  :Postal Code: 54321
39
43
  :State: TX
40
44
  :Street: 54321 Elm Street
@@ -59,7 +63,7 @@ A typical `Field` object will have the following attributes:
59
63
  * **confidence** (Float, nil): the confidence score of the field prediction.
60
64
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
61
65
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
62
- * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
66
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
63
67
  * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
64
68
 
65
69
 
data/docs/us_w9_v1.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  title: US W9 OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-us-w9-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
3
6
  ---
4
7
  The Ruby OCR SDK supports the [W9 API](https://platform.mindee.com/mindee/us_w9).
5
8
 
@@ -24,6 +27,7 @@ result = mindee_client.parse(
24
27
 
25
28
  # Print a full summary of the parsed data in RST format
26
29
  puts result.document
30
+
27
31
  ```
28
32
 
29
33
  **Output (RST):**
@@ -73,7 +77,7 @@ A typical `Field` object will have the following attributes:
73
77
  * **confidence** (Float, nil): the confidence score of the field prediction.
74
78
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
75
79
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
76
- * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
80
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
77
81
  * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
78
82
 
79
83
 
@@ -90,7 +94,7 @@ The position field `PositionField` does not implement all the basic `Field` attr
90
94
  The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
91
95
 
92
96
  ## Page-Level Fields
93
- Some fields are constrained to the page level, and so will not be retrievable to through the document.
97
+ Some fields are constrained to the page level, and so will not be retrievable at document level.
94
98
 
95
99
  # Attributes
96
100
  The following fields are extracted for W9 V1:
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mindee'
4
+
5
+ def invoice_splitter_auto_extraction(file_path)
6
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
7
+ input_source = mindee_client.source_from_path(file_path)
8
+
9
+ if input_source.pdf? && input_source.count_pdf_pages > 1
10
+ parse_multi_page(mindee_client, input_source)
11
+ else
12
+ parse_single_page(mindee_client, input_source)
13
+ end
14
+ end
15
+
16
+ def parse_single_page(mindee_client, input_source)
17
+ invoice_result = mindee_client.parse(
18
+ input_source,
19
+ Mindee::Product::Invoice::InvoiceV4
20
+ )
21
+ puts invoice_result.document
22
+ end
23
+
24
+ def parse_multi_page(mindee_client, input_source)
25
+ pdf_extractor = Mindee::Extraction::PdfExtractor::PdfExtractor.new(input_source)
26
+ invoice_splitter_response = mindee_client.enqueue_and_parse(
27
+ input_source,
28
+ Mindee::Product::InvoiceSplitter::InvoiceSplitterV1,
29
+ close_file: false
30
+ )
31
+ page_groups = invoice_splitter_response.document.inference.prediction.invoice_page_groups
32
+ extracted_pdfs = pdf_extractor.extract_invoices(page_groups, strict: false)
33
+
34
+ extracted_pdfs.each do |extracted_pdf|
35
+ # Optional: Save the files locally
36
+ # extracted_pdf.write_to_file("output/path")
37
+
38
+ invoice_result = mindee_client.parse(
39
+ extracted_pdf.as_input_source,
40
+ Mindee::Product::Invoice::InvoiceV4,
41
+ close_file: false
42
+ )
43
+ puts invoice_result.document
44
+ end
45
+ end
46
+
47
+ my_file_path = '/path/to/the/file.ext'
48
+ invoice_splitter_auto_extraction(my_file_path)
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mindee'
4
+ require 'mindee/extraction'
5
+
6
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
7
+ def multi_receipts_detection(file_path, mindee_client)
8
+ input_source = mindee_client.source_from_path(file_path)
9
+
10
+ result_split = mindee_client.parse(
11
+ input_source,
12
+ Mindee::Product::MultiReceiptsDetector::MultiReceiptsDetectorV1,
13
+ close_file: false
14
+ )
15
+
16
+ images = Mindee::Extraction::MultiReceiptsExtractor.extract_receipts(input_source, result_split.document.inference)
17
+ images.each do |sub_image|
18
+ # Optional: Save the files locally
19
+ # sub_image.write_to_file("/path/to/my/extracted/file/folder")
20
+
21
+ result_receipt = mindee_client.parse(
22
+ sub_image.as_source,
23
+ Mindee::Product::Receipt::ReceiptV5,
24
+ close_file: false
25
+ )
26
+ puts result_receipt.document
27
+ end
28
+ end
29
+
30
+ my_file_path = '/path/to/the/file.ext'
31
+ multi_receipts_detection(my_file_path, mindee_client)