mindee 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/README.md +57 -7
- data/bin/mindee.rb +160 -83
- data/docs/bank_account_details_v2.md +137 -0
- data/docs/bank_check_v1.md +179 -0
- data/docs/barcode_reader_v1.md +104 -0
- data/docs/carte_vitale_v1.md +123 -0
- data/docs/code_samples/barcode_reader_v1.txt +19 -0
- data/docs/code_samples/cropper_v1.txt +16 -0
- data/docs/code_samples/idcard_fr_v2.txt +19 -0
- data/docs/code_samples/invoice_splitter_v1_async.txt +6 -54
- data/docs/code_samples/multi_receipts_detector_v1.txt +19 -0
- data/docs/code_samples/us_w9_v1.txt +16 -0
- data/docs/cropper_v1.md +97 -0
- data/docs/custom_v1.md +101 -0
- data/docs/expense_receipts_v5.md +306 -0
- data/docs/financial_document_v1.md +384 -0
- data/docs/{ruby-getting-started.md → getting_started.md} +22 -6
- data/docs/idcard_fr_v2.md +253 -0
- data/docs/invoice_splitter_v1.md +85 -0
- data/docs/invoices_v4.md +369 -0
- data/docs/license_plates_v1.md +91 -0
- data/docs/multi_receipts_detector_v1.md +105 -0
- data/docs/passport_v1.md +186 -0
- data/docs/proof_of_address_v1.md +207 -0
- data/docs/us_driver_license_v1.md +268 -0
- data/docs/us_w9_v1.md +207 -0
- data/lib/mindee/client.rb +95 -16
- data/lib/mindee/geometry/quadrilateral.rb +5 -0
- data/lib/mindee/http/.rubocop.yml +8 -0
- data/lib/mindee/http/endpoint.rb +14 -6
- data/lib/mindee/http/error.rb +104 -0
- data/lib/mindee/http.rb +1 -0
- data/lib/mindee/input/sources.rb +84 -15
- data/lib/mindee/parsing/common/api_response.rb +11 -1
- data/lib/mindee/parsing/common/inference.rb +2 -2
- data/lib/mindee/parsing/common/ocr/ocr.rb +1 -0
- data/lib/mindee/parsing/common.rb +0 -1
- data/lib/mindee/parsing/standard/company_registration_field.rb +1 -1
- data/lib/mindee/parsing/standard/locale_field.rb +1 -1
- data/lib/mindee/parsing/standard/payment_details_field.rb +1 -1
- data/lib/mindee/parsing/standard/position_field.rb +10 -3
- data/lib/mindee/parsing/standard/{text_field.rb → string_field.rb} +1 -1
- data/lib/mindee/parsing/standard.rb +1 -1
- data/lib/mindee/pdf/pdf_processing.rb +2 -1
- data/lib/mindee/product/barcode_reader/barcode_reader_v1.rb +37 -0
- data/lib/mindee/product/barcode_reader/barcode_reader_v1_document.rb +44 -0
- data/lib/mindee/product/barcode_reader/barcode_reader_v1_page.rb +32 -0
- data/lib/mindee/product/cropper/cropper_v1.rb +37 -0
- data/lib/mindee/product/cropper/cropper_v1_document.rb +13 -0
- data/lib/mindee/product/cropper/cropper_v1_page.rb +49 -0
- data/lib/mindee/product/custom/custom_v1.rb +1 -0
- data/lib/mindee/product/eu/license_plate/license_plate_v1.rb +1 -0
- data/lib/mindee/product/eu/license_plate/license_plate_v1_document.rb +2 -2
- data/lib/mindee/product/financial_document/financial_document_v1.rb +1 -0
- data/lib/mindee/product/financial_document/financial_document_v1_document.rb +24 -24
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1.rb +1 -0
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1_document.rb +6 -6
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2.rb +1 -0
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_document.rb +6 -6
- data/lib/mindee/product/fr/carte_vitale/carte_vitale_v1.rb +1 -0
- data/lib/mindee/product/fr/carte_vitale/carte_vitale_v1_document.rb +6 -6
- data/lib/mindee/product/fr/id_card/id_card_v1.rb +1 -0
- data/lib/mindee/product/fr/id_card/id_card_v1_document.rb +16 -16
- data/lib/mindee/product/fr/id_card/id_card_v2.rb +39 -0
- data/lib/mindee/product/fr/id_card/id_card_v2_document.rb +107 -0
- data/lib/mindee/product/fr/id_card/id_card_v2_page.rb +53 -0
- data/lib/mindee/product/invoice/invoice_v4.rb +1 -0
- data/lib/mindee/product/invoice/invoice_v4_document.rb +24 -24
- data/lib/mindee/product/invoice_splitter/invoice_splitter_v1.rb +1 -0
- data/lib/mindee/product/invoice_splitter/invoice_splitter_v1_document.rb +5 -3
- data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1.rb +37 -0
- data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rb +35 -0
- data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_page.rb +32 -0
- data/lib/mindee/product/passport/passport_v1.rb +1 -0
- data/lib/mindee/product/passport/passport_v1_document.rb +16 -16
- data/lib/mindee/product/proof_of_address/proof_of_address_v1.rb +1 -0
- data/lib/mindee/product/proof_of_address/proof_of_address_v1_document.rb +14 -14
- data/lib/mindee/product/receipt/receipt_v4_document.rb +6 -6
- data/lib/mindee/product/receipt/receipt_v5.rb +1 -0
- data/lib/mindee/product/receipt/receipt_v5_document.rb +12 -12
- data/lib/mindee/product/us/bank_check/bank_check_v1.rb +1 -0
- data/lib/mindee/product/us/bank_check/bank_check_v1_document.rb +8 -8
- data/lib/mindee/product/us/driver_license/driver_license_v1.rb +1 -0
- data/lib/mindee/product/us/driver_license/driver_license_v1_document.rb +28 -28
- data/lib/mindee/product/us/w9/w9_v1.rb +39 -0
- data/lib/mindee/product/us/w9/w9_v1_document.rb +15 -0
- data/lib/mindee/product/us/w9/w9_v1_page.rb +102 -0
- data/lib/mindee/product.rb +5 -0
- data/lib/mindee/version.rb +5 -1
- data/lib/mindee.rb +47 -0
- metadata +43 -9
- data/docs/ruby-api-builder.md +0 -123
- data/docs/ruby-invoice-ocr.md +0 -271
- data/docs/ruby-passport-ocr.md +0 -165
- data/docs/ruby-receipt-ocr.md +0 -196
- data/lib/mindee/parsing/common/error.rb +0 -24
data/docs/custom_v1.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Custom API Ruby
|
|
3
|
+
---
|
|
4
|
+
The Ruby OCR SDK supports [custom-built APIs](https://developers.mindee.com/docs/build-your-first-document-parsing-api).
|
|
5
|
+
If your document isn't covered by one of Mindee's Off-the-Shelf APIs, you can create your own API using the[API Builder](https://platform.mindee.com/api-builder).
|
|
6
|
+
|
|
7
|
+
# Quick-Start
|
|
8
|
+
|
|
9
|
+
```rb
|
|
10
|
+
require 'mindee'
|
|
11
|
+
|
|
12
|
+
# Init a new client
|
|
13
|
+
mindee_client = Mindee::Client.new(api_key: 'my-api-key')
|
|
14
|
+
|
|
15
|
+
# Load a file from disk
|
|
16
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
17
|
+
|
|
18
|
+
# Initialize a custom endpoint for this product
|
|
19
|
+
custom_endpoint = mindee_client.create_endpoint(
|
|
20
|
+
account_name: 'my-account',
|
|
21
|
+
endpoint_name: 'my-endpoint'
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
# Parse the file
|
|
25
|
+
result = mindee_client.parse(
|
|
26
|
+
input_source,
|
|
27
|
+
Mindee::Product::Custom::CustomV1,
|
|
28
|
+
endpoint: custom_endpoint
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
# Print a full summary of the parsed data in RST format
|
|
32
|
+
puts result.document
|
|
33
|
+
|
|
34
|
+
# Print the document-level parsed data
|
|
35
|
+
# puts result.document.inference.prediction
|
|
36
|
+
|
|
37
|
+
# Looping over all prediction values
|
|
38
|
+
result.document.inference.prediction.fields.each do |field_name, field_data|
|
|
39
|
+
puts field_name
|
|
40
|
+
puts field_data.values
|
|
41
|
+
puts field_data.to_s
|
|
42
|
+
end
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
# Custom Endpoints
|
|
46
|
+
|
|
47
|
+
You may have noticed in the previous step that in order to access a custom build, you will need to provide an account and an endpoint name at the very least.
|
|
48
|
+
|
|
49
|
+
Although it is optional, the version number should match the latest version of your build in most use-cases.
|
|
50
|
+
If it is not set, it will default to "1".
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# Field Types
|
|
54
|
+
|
|
55
|
+
## Custom Fields
|
|
56
|
+
|
|
57
|
+
### List Field
|
|
58
|
+
|
|
59
|
+
A `ListField` is a special type of custom list that implements the following:
|
|
60
|
+
|
|
61
|
+
* **confidence** (`Float`): the confidence score of the field prediction.
|
|
62
|
+
* **pageId** (`Integer`): the ID of the page, is `nil` when at document-level.
|
|
63
|
+
* **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
|
|
64
|
+
|
|
65
|
+
Since the inner contents can vary, the value isn't accessed through a property, but rather through the following functions:
|
|
66
|
+
* **contents_list()** (`[Array, Hash, String, nil]`): returns a list of values for each element.
|
|
67
|
+
* **contents_str(separator:' ')** (`String`): returns a list of concatenated values, with an optional **separator** `String` between them.
|
|
68
|
+
* **to_s()**: returns a string representation of all values, with an empty space between each of them.
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### Classification Field
|
|
72
|
+
|
|
73
|
+
A `ClassificationField` is a special type of custom classification that implements the following:
|
|
74
|
+
|
|
75
|
+
* **value** (`String`): the value of the classification. Corresponds to one of the values specified during training.
|
|
76
|
+
* **confidence** (`Float`): the confidence score of the field prediction.
|
|
77
|
+
* **to_s()**: returns a string representation of all values, with an empty space between each of them.
|
|
78
|
+
|
|
79
|
+
# Attributes
|
|
80
|
+
|
|
81
|
+
Custom builds always have access to at least two attributes:
|
|
82
|
+
|
|
83
|
+
## Fields
|
|
84
|
+
|
|
85
|
+
**fields** ({`String`=> [ListField](#list-field)}):
|
|
86
|
+
|
|
87
|
+
```rb
|
|
88
|
+
puts result.document.inference.prediction.fields[:my_field].value
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Classifications
|
|
92
|
+
|
|
93
|
+
**classifications** ({`String` => [ClassificationField](#classification-field)}): The purchase category among predefined classes.
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
console.log(result.document.inference.prediction.classifications["my-classification"].to_s);
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
# Questions?
|
|
100
|
+
|
|
101
|
+
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Receipt OCR Ruby
|
|
3
|
+
---
|
|
4
|
+
The Ruby OCR SDK supports the [Receipt API](https://platform.mindee.com/mindee/expense_receipts).
|
|
5
|
+
|
|
6
|
+
Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/expense_receipts/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK.
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
# Quick-Start
|
|
10
|
+
```rb
|
|
11
|
+
require 'mindee'
|
|
12
|
+
|
|
13
|
+
# Init a new client
|
|
14
|
+
mindee_client = Mindee::Client.new(api_key: 'my-api-key')
|
|
15
|
+
|
|
16
|
+
# Load a file from disk
|
|
17
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
18
|
+
|
|
19
|
+
# Parse the file
|
|
20
|
+
result = mindee_client.parse(
|
|
21
|
+
input_source,
|
|
22
|
+
Mindee::Product::Receipt::ReceiptV5
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
# Print a full summary of the parsed data in RST format
|
|
26
|
+
puts result.document
|
|
27
|
+
|
|
28
|
+
# Print the document-level parsed data
|
|
29
|
+
# puts result.document.inference.prediction
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Output (RST):**
|
|
33
|
+
```rst
|
|
34
|
+
########
|
|
35
|
+
Document
|
|
36
|
+
########
|
|
37
|
+
:Mindee ID: ce41e37a-65d8-4de1-b34b-1c92ab04b1ae
|
|
38
|
+
:Filename: default_sample.jpg
|
|
39
|
+
|
|
40
|
+
Inference
|
|
41
|
+
#########
|
|
42
|
+
:Product: mindee/expense_receipts v5.0
|
|
43
|
+
:Rotation applied: Yes
|
|
44
|
+
|
|
45
|
+
Prediction
|
|
46
|
+
==========
|
|
47
|
+
:Expense Locale: en-GB; en; GB; GBP;
|
|
48
|
+
:Purchase Category: food
|
|
49
|
+
:Purchase Subcategory: restaurant
|
|
50
|
+
:Document Type: EXPENSE RECEIPT
|
|
51
|
+
:Purchase Date: 2016-02-26
|
|
52
|
+
:Purchase Time: 15:20
|
|
53
|
+
:Total Amount: 10.20
|
|
54
|
+
:Total Net: 8.50
|
|
55
|
+
:Total Tax: 1.70
|
|
56
|
+
:Tip and Gratuity:
|
|
57
|
+
:Taxes:
|
|
58
|
+
+---------------+--------+----------+---------------+
|
|
59
|
+
| Base | Code | Rate (%) | Amount |
|
|
60
|
+
+===============+========+==========+===============+
|
|
61
|
+
| 8.50 | VAT | 20.00 | 1.70 |
|
|
62
|
+
+---------------+--------+----------+---------------+
|
|
63
|
+
:Supplier Name: CLACHAN
|
|
64
|
+
:Supplier Company Registrations: 232153895
|
|
65
|
+
232153895
|
|
66
|
+
:Supplier Address: 34 kingley street w1b 5qh
|
|
67
|
+
:Supplier Phone Number: 02074940834
|
|
68
|
+
:Line Items:
|
|
69
|
+
+--------------------------------------+----------+--------------+------------+
|
|
70
|
+
| Description | Quantity | Total Amount | Unit Price |
|
|
71
|
+
+======================================+==========+==============+============+
|
|
72
|
+
| Meantime Pale | 2.00 | 10.20 | |
|
|
73
|
+
+--------------------------------------+----------+--------------+------------+
|
|
74
|
+
|
|
75
|
+
Page Predictions
|
|
76
|
+
================
|
|
77
|
+
|
|
78
|
+
Page 0
|
|
79
|
+
------
|
|
80
|
+
:Expense Locale: en-GB; en; GB; GBP;
|
|
81
|
+
:Purchase Category: food
|
|
82
|
+
:Purchase Subcategory: restaurant
|
|
83
|
+
:Document Type: EXPENSE RECEIPT
|
|
84
|
+
:Purchase Date: 2016-02-26
|
|
85
|
+
:Purchase Time: 15:20
|
|
86
|
+
:Total Amount: 10.20
|
|
87
|
+
:Total Net: 8.50
|
|
88
|
+
:Total Tax: 1.70
|
|
89
|
+
:Tip and Gratuity:
|
|
90
|
+
:Taxes:
|
|
91
|
+
+---------------+--------+----------+---------------+
|
|
92
|
+
| Base | Code | Rate (%) | Amount |
|
|
93
|
+
+===============+========+==========+===============+
|
|
94
|
+
| 8.50 | VAT | 20.00 | 1.70 |
|
|
95
|
+
+---------------+--------+----------+---------------+
|
|
96
|
+
:Supplier Name: CLACHAN
|
|
97
|
+
:Supplier Company Registrations: 232153895
|
|
98
|
+
232153895
|
|
99
|
+
:Supplier Address: 34 kingley street w1b 5qh
|
|
100
|
+
:Supplier Phone Number: 02074940834
|
|
101
|
+
:Line Items:
|
|
102
|
+
+--------------------------------------+----------+--------------+------------+
|
|
103
|
+
| Description | Quantity | Total Amount | Unit Price |
|
|
104
|
+
+======================================+==========+==============+============+
|
|
105
|
+
| Meantime Pale | 2.00 | 10.20 | |
|
|
106
|
+
+--------------------------------------+----------+--------------+------------+
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
# Field Types
|
|
110
|
+
## Standard Fields
|
|
111
|
+
These fields are generic and used in several products.
|
|
112
|
+
|
|
113
|
+
### Basic Field
|
|
114
|
+
Each prediction object contains a set of fields that inherit from the generic `Field` class.
|
|
115
|
+
A typical `Field` object will have the following attributes:
|
|
116
|
+
|
|
117
|
+
* **value** (`String`, `Float`, `Integer`, `Boolean`): corresponds to the field value. Can be `nil` if no value was extracted.
|
|
118
|
+
* **confidence** (Float, nil): the confidence score of the field prediction.
|
|
119
|
+
* **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
|
|
120
|
+
* **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
|
|
121
|
+
* **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
|
|
122
|
+
* **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
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.
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
### Amount Field
|
|
129
|
+
The amount field `AmountField` only has one constraint: its **value** is a `Float` (or `nil`).
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
### Classification Field
|
|
133
|
+
The classification field `ClassificationField` does not implement all the basic `Field` attributes. It only implements **value**, **confidence** and **page_id**.
|
|
134
|
+
|
|
135
|
+
> Note: a classification field's `value is always a `String`.
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
### Company Registration Field
|
|
139
|
+
Aside from the basic `Field` attributes, the company registration field `CompanyRegistrationField` also implements the following:
|
|
140
|
+
|
|
141
|
+
* **type** (`String`): the type of company.
|
|
142
|
+
|
|
143
|
+
### Date Field
|
|
144
|
+
Aside from the basic `Field` attributes, the date field `DateField` also implements the following:
|
|
145
|
+
|
|
146
|
+
* **date_object** (`Date`): an accessible representation of the value as a JavaScript object.
|
|
147
|
+
|
|
148
|
+
### Locale Field
|
|
149
|
+
The locale field `LocaleField` only implements the **value**, **confidence** and **page_id** base `Field` attributes, but it comes with its own:
|
|
150
|
+
|
|
151
|
+
* **language** (`String`): ISO 639-1 language code (e.g.: `en` for English). Can be `nil`.
|
|
152
|
+
* **country** (`String`): ISO 3166-1 alpha-2 or ISO 3166-1 alpha-3 code for countries (e.g.: `GRB` or `GB` for "Great Britain"). Can be `nil`.
|
|
153
|
+
* **currency** (`String`): ISO 4217 code for currencies (e.g.: `USD` for "US Dollars"). Can be `nil`.
|
|
154
|
+
|
|
155
|
+
### String Field
|
|
156
|
+
The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
|
|
157
|
+
|
|
158
|
+
### Taxes Field
|
|
159
|
+
#### Tax
|
|
160
|
+
Aside from the basic `Field` attributes, the tax field `TaxField` also implements the following:
|
|
161
|
+
|
|
162
|
+
* **rate** (`Float`): the tax rate applied to an item can be undefined. Expressed as a percentage. Can be `nil`.
|
|
163
|
+
* **code** (`String`): tax code (or equivalent, depending on the origin of the document). Can be `nil`.
|
|
164
|
+
* **base** (`Float`): base amount used for the tax. Can be `nil`.
|
|
165
|
+
|
|
166
|
+
> Note: currently `TaxField` is not used on its own, and is accessed through a parent `Taxes` object, an array-like structure.
|
|
167
|
+
|
|
168
|
+
#### Taxes (Array)
|
|
169
|
+
The `Taxes` field represents an array-like collection of `TaxField` objects. As it is the representation of several objects, it has access to a custom `to_s` method that can render a `TaxField` object as a table line.
|
|
170
|
+
|
|
171
|
+
## Specific Fields
|
|
172
|
+
Fields which are specific to this product; they are not used in any other product.
|
|
173
|
+
|
|
174
|
+
### Line Items Field
|
|
175
|
+
List of line item details.
|
|
176
|
+
|
|
177
|
+
A `ReceiptV5LineItem` implements the following attributes:
|
|
178
|
+
|
|
179
|
+
* `description` (String): The item description.
|
|
180
|
+
* `quantity` (Float): The item quantity.
|
|
181
|
+
* `total_amount` (Float): The item total amount.
|
|
182
|
+
* `unit_price` (Float): The item unit price.
|
|
183
|
+
|
|
184
|
+
# Attributes
|
|
185
|
+
The following fields are extracted for Receipt V5:
|
|
186
|
+
|
|
187
|
+
## Purchase Category
|
|
188
|
+
**category** ([ClassificationField](#classification-field)): The purchase category among predefined classes.
|
|
189
|
+
|
|
190
|
+
```rb
|
|
191
|
+
puts result.document.inference.prediction.category.value
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Purchase Date
|
|
195
|
+
**date** ([DateField](#date-field)): The date the purchase was made.
|
|
196
|
+
|
|
197
|
+
```rb
|
|
198
|
+
puts result.document.inference.prediction.date.value
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Document Type
|
|
202
|
+
**document_type** ([ClassificationField](#classification-field)): One of: 'CREDIT CARD RECEIPT', 'EXPENSE RECEIPT'.
|
|
203
|
+
|
|
204
|
+
```rb
|
|
205
|
+
puts result.document.inference.prediction.document_type.value
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Line Items
|
|
209
|
+
**line_items** (Array<[ReceiptV5LineItem](#line-items-field)>): List of line item details.
|
|
210
|
+
|
|
211
|
+
```rb
|
|
212
|
+
for line_items_elem in result.document.inference.prediction.line_items do
|
|
213
|
+
puts line_items_elem.value
|
|
214
|
+
end
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Expense Locale
|
|
218
|
+
**locale** ([LocaleField](#locale-field)): The locale detected on the document.
|
|
219
|
+
|
|
220
|
+
```rb
|
|
221
|
+
puts result.document.inference.prediction.locale.value
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Purchase Subcategory
|
|
225
|
+
**subcategory** ([ClassificationField](#classification-field)): The purchase subcategory among predefined classes for transport and food.
|
|
226
|
+
|
|
227
|
+
```rb
|
|
228
|
+
puts result.document.inference.prediction.subcategory.value
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Supplier Address
|
|
232
|
+
**supplier_address** ([StringField](#string-field)): The address of the supplier or merchant.
|
|
233
|
+
|
|
234
|
+
```rb
|
|
235
|
+
puts result.document.inference.prediction.supplier_address.value
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Supplier Company Registrations
|
|
239
|
+
**supplier_company_registrations** (Array<[CompanyRegistrationField](#company-registration-field)>): List of company registrations associated to the supplier.
|
|
240
|
+
|
|
241
|
+
```rb
|
|
242
|
+
for supplier_company_registrations_elem in result.document.inference.prediction.supplier_company_registrations do
|
|
243
|
+
puts supplier_company_registrations_elem.value
|
|
244
|
+
end
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Supplier Name
|
|
248
|
+
**supplier_name** ([StringField](#string-field)): The name of the supplier or merchant.
|
|
249
|
+
|
|
250
|
+
```rb
|
|
251
|
+
puts result.document.inference.prediction.supplier_name.value
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Supplier Phone Number
|
|
255
|
+
**supplier_phone_number** ([StringField](#string-field)): The phone number of the supplier or merchant.
|
|
256
|
+
|
|
257
|
+
```rb
|
|
258
|
+
puts result.document.inference.prediction.supplier_phone_number.value
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Taxes
|
|
262
|
+
**taxes** (Array<[TaxField](#taxes-field)>): List of tax lines information.
|
|
263
|
+
|
|
264
|
+
```rb
|
|
265
|
+
for taxes_elem in result.document.inference.prediction.taxes do
|
|
266
|
+
puts taxes_elem.to_s
|
|
267
|
+
end
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Purchase Time
|
|
271
|
+
**time** ([StringField](#string-field)): The time the purchase was made.
|
|
272
|
+
|
|
273
|
+
```rb
|
|
274
|
+
puts result.document.inference.prediction.time.value
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Tip and Gratuity
|
|
278
|
+
**tip** ([AmountField](#amount-field)): The total amount of tip and gratuity.
|
|
279
|
+
|
|
280
|
+
```rb
|
|
281
|
+
puts result.document.inference.prediction.tip.value
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Total Amount
|
|
285
|
+
**total_amount** ([AmountField](#amount-field)): The total amount paid: includes taxes, discounts, fees, tips, and gratuity.
|
|
286
|
+
|
|
287
|
+
```rb
|
|
288
|
+
puts result.document.inference.prediction.total_amount.value
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## Total Net
|
|
292
|
+
**total_net** ([AmountField](#amount-field)): The net amount paid: does not include taxes, fees, and discounts.
|
|
293
|
+
|
|
294
|
+
```rb
|
|
295
|
+
puts result.document.inference.prediction.total_net.value
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## Total Tax
|
|
299
|
+
**total_tax** ([AmountField](#amount-field)): The total amount of taxes.
|
|
300
|
+
|
|
301
|
+
```rb
|
|
302
|
+
puts result.document.inference.prediction.total_tax.value
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
# Questions?
|
|
306
|
+
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
|