mindee 3.12.0 → 3.13.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 (124) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/CHANGELOG.md +18 -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 +202 -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 +249 -0
  21. data/docs/eu_driver_license_v1.md +6 -2
  22. data/docs/expense_receipts_v5.md +26 -1
  23. data/docs/financial_document_v1.md +29 -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 +54 -21
  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 +295 -0
  33. data/docs/passport_v1.md +5 -1
  34. data/docs/payslip_fra_v2.md +218 -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 +5 -1
  40. data/docs/us_w9_v1.md +6 -2
  41. data/examples/auto_invoice_splitter_extraction.rb +43 -0
  42. data/lib/mindee/client.rb +20 -8
  43. data/lib/mindee/{image_extraction → extraction}/common/image_extractor.rb +2 -4
  44. data/lib/mindee/{image_extraction → extraction}/common.rb +1 -0
  45. data/lib/mindee/extraction/pdf_extractor/extracted_pdf.rb +55 -0
  46. data/lib/mindee/extraction/pdf_extractor/pdf_extractor.rb +111 -0
  47. data/lib/mindee/extraction/pdf_extractor.rb +4 -0
  48. data/lib/mindee/extraction/tax_extractor/tax_extractor.rb +322 -0
  49. data/lib/mindee/extraction/tax_extractor.rb +1 -320
  50. data/lib/mindee/extraction.rb +3 -0
  51. data/lib/mindee/http/endpoint.rb +18 -6
  52. data/lib/mindee/parsing/common/api_response.rb +1 -1
  53. data/lib/mindee/parsing/common/document.rb +31 -1
  54. data/lib/mindee/parsing/common/extras/cropper_extra.rb +29 -0
  55. data/lib/mindee/parsing/common/extras/extras.rb +50 -0
  56. data/lib/mindee/parsing/common/extras/full_text_ocr_extra.rb +32 -0
  57. data/lib/mindee/parsing/common/extras.rb +5 -0
  58. data/lib/mindee/parsing/common/page.rb +5 -0
  59. data/lib/mindee/parsing/standard/base_field.rb +1 -0
  60. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1.rb +39 -0
  61. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rb +52 -0
  62. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_item.rb +95 -0
  63. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_consignee.rb +58 -0
  64. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb +136 -0
  65. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_notify_party.rb +58 -0
  66. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_page.rb +32 -0
  67. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_shipper.rb +58 -0
  68. data/lib/mindee/product/financial_document/financial_document_v1_line_item.rb +15 -1
  69. data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_bban.rb +4 -15
  70. data/lib/mindee/product/fr/energy_bill/energy_bill_v1.rb +41 -0
  71. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb +235 -0
  72. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_consumer.rb +48 -0
  73. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_supplier.rb +48 -0
  74. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.rb +97 -0
  75. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.rb +54 -0
  76. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_page.rb +34 -0
  77. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb +97 -0
  78. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contribution.rb +97 -0
  79. data/lib/mindee/product/fr/payslip/payslip_v2.rb +41 -0
  80. data/lib/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rb +54 -0
  81. data/lib/mindee/product/fr/payslip/payslip_v2_document.rb +128 -0
  82. data/lib/mindee/product/fr/payslip/payslip_v2_employee.rb +78 -0
  83. data/lib/mindee/product/fr/payslip/payslip_v2_employer.rb +78 -0
  84. data/lib/mindee/product/fr/payslip/payslip_v2_employment.rb +72 -0
  85. data/lib/mindee/product/fr/payslip/payslip_v2_page.rb +34 -0
  86. data/lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb +100 -0
  87. data/lib/mindee/product/fr/payslip/payslip_v2_pay_period.rb +66 -0
  88. data/lib/mindee/product/fr/payslip/payslip_v2_pto.rb +56 -0
  89. data/lib/mindee/product/fr/payslip/payslip_v2_salary_detail.rb +81 -0
  90. data/lib/mindee/product/invoice/invoice_v4_line_item.rb +15 -1
  91. data/lib/mindee/product/invoice_splitter/invoice_splitter_v1_document.rb +1 -1
  92. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1.rb +39 -0
  93. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_added_sugar.rb +52 -0
  94. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_calorie.rb +52 -0
  95. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_cholesterol.rb +52 -0
  96. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_dietary_fiber.rb +52 -0
  97. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_document.rb +173 -0
  98. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrient.rb +87 -0
  99. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_page.rb +32 -0
  100. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_protein.rb +52 -0
  101. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_saturated_fat.rb +52 -0
  102. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_serving_size.rb +46 -0
  103. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_sodium.rb +58 -0
  104. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_carbohydrate.rb +52 -0
  105. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_fat.rb +52 -0
  106. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_sugar.rb +52 -0
  107. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_trans_fat.rb +52 -0
  108. data/lib/mindee/product/receipt/receipt_v5_line_item.rb +11 -1
  109. data/lib/mindee/product/resume/resume_v1_certificate.rb +11 -1
  110. data/lib/mindee/product/resume/resume_v1_education.rb +14 -1
  111. data/lib/mindee/product/resume/resume_v1_language.rb +9 -1
  112. data/lib/mindee/product/resume/resume_v1_professional_experience.rb +15 -1
  113. data/lib/mindee/product/resume/resume_v1_social_networks_url.rb +9 -1
  114. data/lib/mindee/product/us/healthcare_card/healthcare_card_v1_copay.rb +9 -1
  115. data/lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb +14 -1
  116. data/lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb +5 -17
  117. data/lib/mindee/product.rb +5 -1
  118. data/lib/mindee/version.rb +1 -1
  119. metadata +70 -9
  120. data/lib/mindee/image_extraction.rb +0 -4
  121. /data/lib/mindee/{image_extraction → extraction}/common/extracted_image.rb +0 -0
  122. /data/lib/mindee/{image_extraction → extraction}/multi_receipts_extractor/multi_receipts_extractor.rb +0 -0
  123. /data/lib/mindee/{image_extraction → extraction}/multi_receipts_extractor.rb +0 -0
  124. /data/lib/mindee/extraction/{ocr_extractor.rb → tax_extractor/ocr_extractor.rb} +0 -0
data/docs/invoices_v4.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  title: Invoice OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-invoice-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
3
6
  ---
4
7
  The Ruby OCR SDK supports the [Invoice API](https://platform.mindee.com/mindee/invoices).
5
8
 
@@ -27,6 +30,32 @@ puts result.document
27
30
 
28
31
  # Print the document-level parsed data
29
32
  # puts result.document.inference.prediction
33
+
34
+ ```
35
+
36
+ You can also call this product asynchronously:
37
+
38
+ ```rb
39
+ require 'mindee'
40
+
41
+ # Init a new client
42
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
43
+
44
+ # Load a file from disk
45
+ input_source = mindee_client.source_from_path('/path/to/the/file.ext')
46
+
47
+ # Parse the file
48
+ result = mindee_client.enqueue_and_parse(
49
+ input_source,
50
+ Mindee::Product::Invoice::InvoiceV4
51
+ )
52
+
53
+ # Print a full summary of the parsed data in RST format
54
+ puts result.document
55
+
56
+ # Print the document-level parsed data
57
+ # puts result.document.inference.prediction
58
+
30
59
  ```
31
60
 
32
61
  **Output (RST):**
@@ -34,12 +63,12 @@ puts result.document
34
63
  ########
35
64
  Document
36
65
  ########
37
- :Mindee ID: 128a314f-1adb-42eb-a9e3-402055a8b8ce
66
+ :Mindee ID: 372d9d08-59d8-4e1c-9622-06648c1c238b
38
67
  :Filename: default_sample.jpg
39
68
 
40
69
  Inference
41
70
  #########
42
- :Product: mindee/invoices v4.6
71
+ :Product: mindee/invoices v4.7
43
72
  :Rotation applied: Yes
44
73
 
45
74
  Prediction
@@ -73,15 +102,15 @@ Prediction
73
102
  :Billing Address: 1954 Bloor Street West Toronto, ON, M6P 3K9 Canada
74
103
  :Document Type: INVOICE
75
104
  :Line Items:
76
- +--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
77
- | Description | Product code | Quantity | Tax Amount | Tax Rate (%) | Total Amount | Unit Price |
78
- +======================================+==============+==========+============+==============+==============+============+
79
- | Platinum web hosting package Down... | | 1.00 | | | 65.00 | 65.00 |
80
- +--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
81
- | 2 page website design Includes ba... | | 3.00 | | | 2100.00 | 2100.00 |
82
- +--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
83
- | Mobile designs Includes responsiv... | | 1.00 | | | 250.00 | 250.00 |
84
- +--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
105
+ +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
106
+ | Description | Product code | Quantity | Tax Amount | Tax Rate (%) | Total Amount | Unit of measure | Unit Price |
107
+ +======================================+==============+==========+============+==============+==============+=================+============+
108
+ | Platinum web hosting package Down... | | 1.00 | | | 65.00 | | 65.00 |
109
+ +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
110
+ | 2 page website design Includes ba... | | 3.00 | | | 2100.00 | | 2100.00 |
111
+ +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
112
+ | Mobile designs Includes responsiv... | | 1.00 | | | 250.00 | 1 | 250.00 |
113
+ +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
85
114
 
86
115
  Page Predictions
87
116
  ================
@@ -117,15 +146,15 @@ Page 0
117
146
  :Billing Address: 1954 Bloor Street West Toronto, ON, M6P 3K9 Canada
118
147
  :Document Type: INVOICE
119
148
  :Line Items:
120
- +--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
121
- | Description | Product code | Quantity | Tax Amount | Tax Rate (%) | Total Amount | Unit Price |
122
- +======================================+==============+==========+============+==============+==============+============+
123
- | Platinum web hosting package Down... | | 1.00 | | | 65.00 | 65.00 |
124
- +--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
125
- | 2 page website design Includes ba... | | 3.00 | | | 2100.00 | 2100.00 |
126
- +--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
127
- | Mobile designs Includes responsiv... | | 1.00 | | | 250.00 | 250.00 |
128
- +--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
149
+ +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
150
+ | Description | Product code | Quantity | Tax Amount | Tax Rate (%) | Total Amount | Unit of measure | Unit Price |
151
+ +======================================+==============+==========+============+==============+==============+=================+============+
152
+ | Platinum web hosting package Down... | | 1.00 | | | 65.00 | | 65.00 |
153
+ +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
154
+ | 2 page website design Includes ba... | | 3.00 | | | 2100.00 | | 2100.00 |
155
+ +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
156
+ | Mobile designs Includes responsiv... | | 1.00 | | | 250.00 | 1 | 250.00 |
157
+ +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
129
158
  ```
130
159
 
131
160
  # Field Types
@@ -140,7 +169,7 @@ A typical `Field` object will have the following attributes:
140
169
  * **confidence** (Float, nil): the confidence score of the field prediction.
141
170
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
142
171
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
143
- * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
172
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
144
173
  * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
145
174
 
146
175
 
@@ -265,6 +294,10 @@ puts result.document.inference.prediction.date.value
265
294
  ## Document Type
266
295
  **document_type** ([ClassificationField](#classification-field)): One of: 'INVOICE', 'CREDIT NOTE'.
267
296
 
297
+ #### Possible values include:
298
+ - INVOICE
299
+ - CREDIT NOTE
300
+
268
301
  ```rb
269
302
  puts result.document.inference.prediction.document_type.value
270
303
  ```
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  title: EU License Plate OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-eu-license-plate-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
3
6
  ---
4
7
  The Ruby OCR SDK supports the [License Plate API](https://platform.mindee.com/mindee/license_plates).
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):**
@@ -66,7 +70,7 @@ A typical `Field` object will have the following attributes:
66
70
  * **confidence** (Float, nil): the confidence score of the field prediction.
67
71
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
68
72
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
69
- * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
73
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
70
74
  * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
71
75
 
72
76
 
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  title: Multi Receipts Detector OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-multi-receipts-detector-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
3
6
  ---
4
7
  The Ruby OCR SDK supports the [Multi Receipts Detector API](https://platform.mindee.com/mindee/multi_receipts_detector).
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):**
@@ -76,7 +80,7 @@ A typical `Field` object will have the following attributes:
76
80
  * **confidence** (Float, nil): the confidence score of the field prediction.
77
81
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
78
82
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
79
- * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
83
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
80
84
  * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
81
85
 
82
86
 
@@ -0,0 +1,295 @@
1
+ ---
2
+ title: Nutrition Facts Label OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-nutrition-facts-label-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
6
+ ---
7
+ The Ruby OCR SDK supports the [Nutrition Facts Label API](https://platform.mindee.com/mindee/nutrition_facts).
8
+
9
+ The [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/nutrition_facts/default_sample.jpg) can be used for testing purposes.
10
+ ![Nutrition Facts Label sample](https://github.com/mindee/client-lib-test-data/blob/main/products/nutrition_facts/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::NutritionFactsLabel::NutritionFactsLabelV1
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
+ # Field Types
36
+ ## Standard Fields
37
+ These fields are generic and used in several products.
38
+
39
+ ### Basic Field
40
+ Each prediction object contains a set of fields that inherit from the generic `Field` class.
41
+ A typical `Field` object will have the following attributes:
42
+
43
+ * **value** (`String`, `Float`, `Integer`, `Boolean`): corresponds to the field value. Can be `nil` if no value was extracted.
44
+ * **confidence** (Float, nil): the confidence score of the field prediction.
45
+ * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
46
+ * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
47
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
48
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
49
+
50
+
51
+ 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.
52
+
53
+
54
+ ### Amount Field
55
+ The amount field `AmountField` only has one constraint: its **value** is a `Float` (or `nil`).
56
+
57
+ ## Specific Fields
58
+ Fields which are specific to this product; they are not used in any other product.
59
+
60
+ ### Added Sugars Field
61
+ The amount of added sugars in the product.
62
+
63
+ A `NutritionFactsLabelV1AddedSugar` implements the following attributes:
64
+
65
+ * `daily_value` (Float): DVs are the recommended amounts of added sugars to consume or not to exceed each day.
66
+ * `per_100g` (Float): The amount of added sugars per 100g of the product.
67
+ * `per_serving` (Float): The amount of added sugars per serving of the product.
68
+ Fields which are specific to this product; they are not used in any other product.
69
+
70
+ ### Calories Field
71
+ The amount of calories in the product.
72
+
73
+ A `NutritionFactsLabelV1Calorie` implements the following attributes:
74
+
75
+ * `daily_value` (Float): DVs are the recommended amounts of calories to consume or not to exceed each day.
76
+ * `per_100g` (Float): The amount of calories per 100g of the product.
77
+ * `per_serving` (Float): The amount of calories per serving of the product.
78
+ Fields which are specific to this product; they are not used in any other product.
79
+
80
+ ### Cholesterol Field
81
+ The amount of cholesterol in the product.
82
+
83
+ A `NutritionFactsLabelV1Cholesterol` implements the following attributes:
84
+
85
+ * `daily_value` (Float): DVs are the recommended amounts of cholesterol to consume or not to exceed each day.
86
+ * `per_100g` (Float): The amount of cholesterol per 100g of the product.
87
+ * `per_serving` (Float): The amount of cholesterol per serving of the product.
88
+ Fields which are specific to this product; they are not used in any other product.
89
+
90
+ ### Dietary Fiber Field
91
+ The amount of dietary fiber in the product.
92
+
93
+ A `NutritionFactsLabelV1DietaryFiber` implements the following attributes:
94
+
95
+ * `daily_value` (Float): DVs are the recommended amounts of dietary fiber to consume or not to exceed each day.
96
+ * `per_100g` (Float): The amount of dietary fiber per 100g of the product.
97
+ * `per_serving` (Float): The amount of dietary fiber per serving of the product.
98
+ Fields which are specific to this product; they are not used in any other product.
99
+
100
+ ### nutrients Field
101
+ The amount of nutrients in the product.
102
+
103
+ A `NutritionFactsLabelV1Nutrient` implements the following attributes:
104
+
105
+ * `daily_value` (Float): DVs are the recommended amounts of nutrients to consume or not to exceed each day.
106
+ * `name` (String): The name of nutrients of the product.
107
+ * `per_100g` (Float): The amount of nutrients per 100g of the product.
108
+ * `per_serving` (Float): The amount of nutrients per serving of the product.
109
+ * `unit` (String): The unit of measurement for the amount of nutrients.
110
+ Fields which are specific to this product; they are not used in any other product.
111
+
112
+ ### Protein Field
113
+ The amount of protein in the product.
114
+
115
+ A `NutritionFactsLabelV1Protein` implements the following attributes:
116
+
117
+ * `daily_value` (Float): DVs are the recommended amounts of protein to consume or not to exceed each day.
118
+ * `per_100g` (Float): The amount of protein per 100g of the product.
119
+ * `per_serving` (Float): The amount of protein per serving of the product.
120
+ Fields which are specific to this product; they are not used in any other product.
121
+
122
+ ### Saturated Fat Field
123
+ The amount of saturated fat in the product.
124
+
125
+ A `NutritionFactsLabelV1SaturatedFat` implements the following attributes:
126
+
127
+ * `daily_value` (Float): DVs are the recommended amounts of saturated fat to consume or not to exceed each day.
128
+ * `per_100g` (Float): The amount of saturated fat per 100g of the product.
129
+ * `per_serving` (Float): The amount of saturated fat per serving of the product.
130
+ Fields which are specific to this product; they are not used in any other product.
131
+
132
+ ### Serving Size Field
133
+ The size of a single serving of the product.
134
+
135
+ A `NutritionFactsLabelV1ServingSize` implements the following attributes:
136
+
137
+ * `amount` (Float): The amount of a single serving.
138
+ * `unit` (String): The unit for the amount of a single serving.
139
+ Fields which are specific to this product; they are not used in any other product.
140
+
141
+ ### sodium Field
142
+ The amount of sodium in the product.
143
+
144
+ A `NutritionFactsLabelV1Sodium` implements the following attributes:
145
+
146
+ * `daily_value` (Float): DVs are the recommended amounts of sodium to consume or not to exceed each day.
147
+ * `per_100g` (Float): The amount of sodium per 100g of the product.
148
+ * `per_serving` (Float): The amount of sodium per serving of the product.
149
+ * `unit` (String): The unit of measurement for the amount of sodium.
150
+ Fields which are specific to this product; they are not used in any other product.
151
+
152
+ ### Total Carbohydrate Field
153
+ The total amount of carbohydrates in the product.
154
+
155
+ A `NutritionFactsLabelV1TotalCarbohydrate` implements the following attributes:
156
+
157
+ * `daily_value` (Float): DVs are the recommended amounts of total carbohydrates to consume or not to exceed each day.
158
+ * `per_100g` (Float): The amount of total carbohydrates per 100g of the product.
159
+ * `per_serving` (Float): The amount of total carbohydrates per serving of the product.
160
+ Fields which are specific to this product; they are not used in any other product.
161
+
162
+ ### Total Fat Field
163
+ The total amount of fat in the product.
164
+
165
+ A `NutritionFactsLabelV1TotalFat` implements the following attributes:
166
+
167
+ * `daily_value` (Float): DVs are the recommended amounts of total fat to consume or not to exceed each day.
168
+ * `per_100g` (Float): The amount of total fat per 100g of the product.
169
+ * `per_serving` (Float): The amount of total fat per serving of the product.
170
+ Fields which are specific to this product; they are not used in any other product.
171
+
172
+ ### Total Sugars Field
173
+ The total amount of sugars in the product.
174
+
175
+ A `NutritionFactsLabelV1TotalSugar` implements the following attributes:
176
+
177
+ * `daily_value` (Float): DVs are the recommended amounts of total sugars to consume or not to exceed each day.
178
+ * `per_100g` (Float): The amount of total sugars per 100g of the product.
179
+ * `per_serving` (Float): The amount of total sugars per serving of the product.
180
+ Fields which are specific to this product; they are not used in any other product.
181
+
182
+ ### Trans Fat Field
183
+ The amount of trans fat in the product.
184
+
185
+ A `NutritionFactsLabelV1TransFat` implements the following attributes:
186
+
187
+ * `daily_value` (Float): DVs are the recommended amounts of trans fat to consume or not to exceed each day.
188
+ * `per_100g` (Float): The amount of trans fat per 100g of the product.
189
+ * `per_serving` (Float): The amount of trans fat per serving of the product.
190
+
191
+ # Attributes
192
+ The following fields are extracted for Nutrition Facts Label V1:
193
+
194
+ ## Added Sugars
195
+ **added_sugars** ([NutritionFactsLabelV1AddedSugar](#added-sugars-field)): The amount of added sugars in the product.
196
+
197
+ ```rb
198
+ puts result.document.inference.prediction.added_sugars.value
199
+ ```
200
+
201
+ ## Calories
202
+ **calories** ([NutritionFactsLabelV1Calorie](#calories-field)): The amount of calories in the product.
203
+
204
+ ```rb
205
+ puts result.document.inference.prediction.calories.value
206
+ ```
207
+
208
+ ## Cholesterol
209
+ **cholesterol** ([NutritionFactsLabelV1Cholesterol](#cholesterol-field)): The amount of cholesterol in the product.
210
+
211
+ ```rb
212
+ puts result.document.inference.prediction.cholesterol.value
213
+ ```
214
+
215
+ ## Dietary Fiber
216
+ **dietary_fiber** ([NutritionFactsLabelV1DietaryFiber](#dietary-fiber-field)): The amount of dietary fiber in the product.
217
+
218
+ ```rb
219
+ puts result.document.inference.prediction.dietary_fiber.value
220
+ ```
221
+
222
+ ## nutrients
223
+ **nutrients** (Array<[NutritionFactsLabelV1Nutrient](#nutrients-field)>): The amount of nutrients in the product.
224
+
225
+ ```rb
226
+ for nutrients_elem in result.document.inference.prediction.nutrients do
227
+ puts nutrients_elem.value
228
+ end
229
+ ```
230
+
231
+ ## Protein
232
+ **protein** ([NutritionFactsLabelV1Protein](#protein-field)): The amount of protein in the product.
233
+
234
+ ```rb
235
+ puts result.document.inference.prediction.protein.value
236
+ ```
237
+
238
+ ## Saturated Fat
239
+ **saturated_fat** ([NutritionFactsLabelV1SaturatedFat](#saturated-fat-field)): The amount of saturated fat in the product.
240
+
241
+ ```rb
242
+ puts result.document.inference.prediction.saturated_fat.value
243
+ ```
244
+
245
+ ## Serving per Box
246
+ **serving_per_box** ([AmountField](#amount-field)): The number of servings in each box of the product.
247
+
248
+ ```rb
249
+ puts result.document.inference.prediction.serving_per_box.value
250
+ ```
251
+
252
+ ## Serving Size
253
+ **serving_size** ([NutritionFactsLabelV1ServingSize](#serving-size-field)): The size of a single serving of the product.
254
+
255
+ ```rb
256
+ puts result.document.inference.prediction.serving_size.value
257
+ ```
258
+
259
+ ## sodium
260
+ **sodium** ([NutritionFactsLabelV1Sodium](#sodium-field)): The amount of sodium in the product.
261
+
262
+ ```rb
263
+ puts result.document.inference.prediction.sodium.value
264
+ ```
265
+
266
+ ## Total Carbohydrate
267
+ **total_carbohydrate** ([NutritionFactsLabelV1TotalCarbohydrate](#total-carbohydrate-field)): The total amount of carbohydrates in the product.
268
+
269
+ ```rb
270
+ puts result.document.inference.prediction.total_carbohydrate.value
271
+ ```
272
+
273
+ ## Total Fat
274
+ **total_fat** ([NutritionFactsLabelV1TotalFat](#total-fat-field)): The total amount of fat in the product.
275
+
276
+ ```rb
277
+ puts result.document.inference.prediction.total_fat.value
278
+ ```
279
+
280
+ ## Total Sugars
281
+ **total_sugars** ([NutritionFactsLabelV1TotalSugar](#total-sugars-field)): The total amount of sugars in the product.
282
+
283
+ ```rb
284
+ puts result.document.inference.prediction.total_sugars.value
285
+ ```
286
+
287
+ ## Trans Fat
288
+ **trans_fat** ([NutritionFactsLabelV1TransFat](#trans-fat-field)): The amount of trans fat in the product.
289
+
290
+ ```rb
291
+ puts result.document.inference.prediction.trans_fat.value
292
+ ```
293
+
294
+ # Questions?
295
+ [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
data/docs/passport_v1.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  title: Passport OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-passport-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
3
6
  ---
4
7
  The Ruby OCR SDK supports the [Passport API](https://platform.mindee.com/mindee/passport).
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):**
@@ -86,7 +90,7 @@ A typical `Field` object will have the following attributes:
86
90
  * **confidence** (Float, nil): the confidence score of the field prediction.
87
91
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
88
92
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
89
- * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
93
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
90
94
  * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
91
95
 
92
96