mindee 3.2.0 → 3.3.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/.gitignore +1 -0
- data/.rubocop.yml +1 -0
- data/CHANGELOG.md +10 -0
- data/bin/mindee.rb +1 -1
- data/docs/barcode_reader_v1.md +2 -2
- data/docs/carte_grise_v1.md +454 -0
- data/docs/code_samples/carte_grise_v1.txt +19 -0
- data/docs/cropper_v1.md +1 -1
- data/docs/custom_v1.md +9 -1
- data/docs/expense_receipts_v5.md +1 -1
- data/docs/financial_document_v1.md +6 -6
- data/docs/invoices_v4.md +68 -99
- data/docs/multi_receipts_detector_v1.md +1 -1
- data/docs/us_w9_v1.md +3 -3
- data/lib/mindee/http/endpoint.rb +5 -1
- data/lib/mindee/http/error.rb +1 -1
- data/lib/mindee/parsing/common/api_response.rb +3 -2
- data/lib/mindee/parsing/common/document.rb +4 -1
- data/lib/mindee/parsing/custom/list_field.rb +7 -5
- data/lib/mindee/parsing/standard/base_field.rb +1 -1
- data/lib/mindee/product/financial_document/financial_document_v1_document.rb +2 -2
- data/lib/mindee/product/fr/carte_grise/carte_grise_v1.rb +39 -0
- data/lib/mindee/product/fr/carte_grise/carte_grise_v1_document.rb +235 -0
- data/lib/mindee/product/fr/carte_grise/carte_grise_v1_page.rb +34 -0
- data/lib/mindee/product/invoice/invoice_v4.rb +1 -2
- data/lib/mindee/product/invoice/invoice_v4_document.rb +105 -145
- data/lib/mindee/product/invoice/invoice_v4_line_item.rb +54 -30
- data/lib/mindee/product/us/w9/w9_v1.rb +2 -2
- data/lib/mindee/product/us/w9/w9_v1_document.rb +1 -1
- data/lib/mindee/product/us/w9/w9_v1_page.rb +2 -2
- data/lib/mindee/product.rb +1 -0
- data/lib/mindee/version.rb +1 -1
- data/lib/mindee.rb +0 -3
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba0a25a68b96ba432920774b10de815c3dbf89386d9e74ea22b13fc36535e50a
|
4
|
+
data.tar.gz: a4f6f9d5da64be2c83ecdd32fdc6f8322998c470c1f94a099dff417ac9419671
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7af6e145ded009966a409c35bc7058158532cee1cc927486b1b05a003a3c8238968305ee4e546cc354abb3b78a5bc45caf4379b1e586bdcf61d800a766368b6
|
7
|
+
data.tar.gz: 591c6e87b9fcdc25b88bf3da8f6fd38c950fb9b03c6aeb096a14bc1f0da9dbf458c7445f137cbc27cef823126472b03653960ba741ea30083642da443f9f523a
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Mindee Ruby API Library Changelog
|
2
2
|
|
3
|
+
## v3.3.0 - 2023-11-17
|
4
|
+
### Changes
|
5
|
+
* :sparkles: add support for Carte Grise V1
|
6
|
+
* :sparkles: add page number attributes to doc
|
7
|
+
* :arrow_up: update tests, docs & display format for some products
|
8
|
+
|
9
|
+
### Fixes
|
10
|
+
* :bug: fix page id not working on newer custom models
|
11
|
+
|
12
|
+
|
3
13
|
## v3.2.0 - 2023-09-15
|
4
14
|
### Changes
|
5
15
|
* :sparkles: add support for Multi Receipts Detector V1
|
data/bin/mindee.rb
CHANGED
data/docs/barcode_reader_v1.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
---
|
2
|
-
title: Barcode Reader
|
2
|
+
title: Barcode Reader OCR Ruby
|
3
3
|
---
|
4
4
|
The Ruby OCR SDK supports the [Barcode Reader API](https://platform.mindee.com/mindee/barcode_reader).
|
5
5
|
|
@@ -34,7 +34,7 @@ puts result.document
|
|
34
34
|
########
|
35
35
|
Document
|
36
36
|
########
|
37
|
-
:Mindee ID:
|
37
|
+
:Mindee ID: f9c48da1-a306-4805-8da8-f7231fda2d88
|
38
38
|
:Filename: default_sample.jpg
|
39
39
|
|
40
40
|
Inference
|
@@ -0,0 +1,454 @@
|
|
1
|
+
---
|
2
|
+
title: FR Carte Grise OCR Ruby
|
3
|
+
---
|
4
|
+
The Ruby OCR SDK supports the [Carte Grise API](https://platform.mindee.com/mindee/carte_grise).
|
5
|
+
|
6
|
+
Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/carte_grise/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::FR::CarteGrise::CarteGriseV1
|
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: f0e0f7a9-0f44-4a3d-92c7-5be262133d33
|
38
|
+
:Filename: default_sample.jpg
|
39
|
+
|
40
|
+
Inference
|
41
|
+
#########
|
42
|
+
:Product: mindee/carte_grise v1.0
|
43
|
+
:Rotation applied: Yes
|
44
|
+
|
45
|
+
Prediction
|
46
|
+
==========
|
47
|
+
:a: AB-123-CD
|
48
|
+
:b: 1998-01-05
|
49
|
+
:c1: DUPONT YVES
|
50
|
+
:c3: 27 RUE DES ROITELETS 59169 FERIN LES BAINS FRANCE
|
51
|
+
:c41: 2 DELAROCHE
|
52
|
+
:c4a: EST LE PROPRIETAIRE DU VEHICULE
|
53
|
+
:d1:
|
54
|
+
:d3: MODELE
|
55
|
+
:e: VFS1V2009AS1V2009
|
56
|
+
:f1: 1915
|
57
|
+
:f2: 1915
|
58
|
+
:f3: 1915
|
59
|
+
:g: 3030
|
60
|
+
:g1: 1307
|
61
|
+
:i: 2009-12-04
|
62
|
+
:j: N1
|
63
|
+
:j1: VP
|
64
|
+
:j2: AA
|
65
|
+
:j3: CI
|
66
|
+
:p1: 1900
|
67
|
+
:p2: 90
|
68
|
+
:p3: GO
|
69
|
+
:p6: 6
|
70
|
+
:q:
|
71
|
+
:s1: 5
|
72
|
+
:s2:
|
73
|
+
:u1: 77
|
74
|
+
:u2: 3000
|
75
|
+
:v7: 155
|
76
|
+
:x1: 2011-07-06
|
77
|
+
:y1:
|
78
|
+
:y2:
|
79
|
+
:y3: 0
|
80
|
+
:y4: 4
|
81
|
+
:y5: 2.5
|
82
|
+
:y6: 178.35
|
83
|
+
:Formula Number: 2009AS05284
|
84
|
+
:Owner's First Name: YVES
|
85
|
+
:Owner's Surname: DUPONT
|
86
|
+
:MRZ Line 1:
|
87
|
+
:MRZ Line 2: CI<<MARQUES<<<<<<<MODELE<<<<<<<2009AS0528402
|
88
|
+
|
89
|
+
Page Predictions
|
90
|
+
================
|
91
|
+
|
92
|
+
Page 0
|
93
|
+
------
|
94
|
+
:a: AB-123-CD
|
95
|
+
:b: 1998-01-05
|
96
|
+
:c1: DUPONT YVES
|
97
|
+
:c3: 27 RUE DES ROITELETS 59169 FERIN LES BAINS FRANCE
|
98
|
+
:c41: 2 DELAROCHE
|
99
|
+
:c4a: EST LE PROPRIETAIRE DU VEHICULE
|
100
|
+
:d1:
|
101
|
+
:d3: MODELE
|
102
|
+
:e: VFS1V2009AS1V2009
|
103
|
+
:f1: 1915
|
104
|
+
:f2: 1915
|
105
|
+
:f3: 1915
|
106
|
+
:g: 3030
|
107
|
+
:g1: 1307
|
108
|
+
:i: 2009-12-04
|
109
|
+
:j: N1
|
110
|
+
:j1: VP
|
111
|
+
:j2: AA
|
112
|
+
:j3: CI
|
113
|
+
:p1: 1900
|
114
|
+
:p2: 90
|
115
|
+
:p3: GO
|
116
|
+
:p6: 6
|
117
|
+
:q: 006
|
118
|
+
:s1: 5
|
119
|
+
:s2:
|
120
|
+
:u1: 77
|
121
|
+
:u2: 3000
|
122
|
+
:v7: 155
|
123
|
+
:x1: 2011-07-06
|
124
|
+
:y1: 17835
|
125
|
+
:y2:
|
126
|
+
:y3: 0
|
127
|
+
:y4: 4
|
128
|
+
:y5: 2.5
|
129
|
+
:y6: 178.35
|
130
|
+
:Formula Number: 2009AS05284
|
131
|
+
:Owner's First Name: YVES
|
132
|
+
:Owner's Surname: DUPONT
|
133
|
+
:MRZ Line 1:
|
134
|
+
:MRZ Line 2: CI<<MARQUES<<<<<<<MODELE<<<<<<<2009AS0528402
|
135
|
+
```
|
136
|
+
|
137
|
+
# Field Types
|
138
|
+
## Standard Fields
|
139
|
+
These fields are generic and used in several products.
|
140
|
+
|
141
|
+
### Basic Field
|
142
|
+
Each prediction object contains a set of fields that inherit from the generic `Field` class.
|
143
|
+
A typical `Field` object will have the following attributes:
|
144
|
+
|
145
|
+
* **value** (`String`, `Float`, `Integer`, `Boolean`): corresponds to the field value. Can be `nil` if no value was extracted.
|
146
|
+
* **confidence** (Float, nil): the confidence score of the field prediction.
|
147
|
+
* **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
|
148
|
+
* **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
|
149
|
+
* **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
|
150
|
+
* **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
|
151
|
+
|
152
|
+
|
153
|
+
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.
|
154
|
+
|
155
|
+
### Date Field
|
156
|
+
Aside from the basic `Field` attributes, the date field `DateField` also implements the following:
|
157
|
+
|
158
|
+
* **date_object** (`Date`): an accessible representation of the value as a JavaScript object.
|
159
|
+
|
160
|
+
### String Field
|
161
|
+
The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
|
162
|
+
|
163
|
+
# Attributes
|
164
|
+
The following fields are extracted for Carte Grise V1:
|
165
|
+
|
166
|
+
## a
|
167
|
+
**a** ([StringField](#string-field)): The vehicle's license plate number.
|
168
|
+
|
169
|
+
```rb
|
170
|
+
puts result.document.inference.prediction.a.value
|
171
|
+
```
|
172
|
+
|
173
|
+
## b
|
174
|
+
**b** ([DateField](#date-field)): The vehicle's first release date.
|
175
|
+
|
176
|
+
```rb
|
177
|
+
puts result.document.inference.prediction.b.value
|
178
|
+
```
|
179
|
+
|
180
|
+
## c1
|
181
|
+
**c1** ([StringField](#string-field)): The vehicle owner's full name including maiden name.
|
182
|
+
|
183
|
+
```rb
|
184
|
+
puts result.document.inference.prediction.c1.value
|
185
|
+
```
|
186
|
+
|
187
|
+
## c3
|
188
|
+
**c3** ([StringField](#string-field)): The vehicle owner's address.
|
189
|
+
|
190
|
+
```rb
|
191
|
+
puts result.document.inference.prediction.c3.value
|
192
|
+
```
|
193
|
+
|
194
|
+
## c41
|
195
|
+
**c41** ([StringField](#string-field)): Number of owners of the license certificate.
|
196
|
+
|
197
|
+
```rb
|
198
|
+
puts result.document.inference.prediction.c41.value
|
199
|
+
```
|
200
|
+
|
201
|
+
## c4a
|
202
|
+
**c4a** ([StringField](#string-field)): Mentions about the ownership of the vehicle.
|
203
|
+
|
204
|
+
```rb
|
205
|
+
puts result.document.inference.prediction.c4a.value
|
206
|
+
```
|
207
|
+
|
208
|
+
## d1
|
209
|
+
**d1** ([StringField](#string-field)): The vehicle's brand.
|
210
|
+
|
211
|
+
```rb
|
212
|
+
puts result.document.inference.prediction.d1.value
|
213
|
+
```
|
214
|
+
|
215
|
+
## d3
|
216
|
+
**d3** ([StringField](#string-field)): The vehicle's commercial name.
|
217
|
+
|
218
|
+
```rb
|
219
|
+
puts result.document.inference.prediction.d3.value
|
220
|
+
```
|
221
|
+
|
222
|
+
## e
|
223
|
+
**e** ([StringField](#string-field)): The Vehicle Identification Number (VIN).
|
224
|
+
|
225
|
+
```rb
|
226
|
+
puts result.document.inference.prediction.e.value
|
227
|
+
```
|
228
|
+
|
229
|
+
## f1
|
230
|
+
**f1** ([StringField](#string-field)): The vehicle's maximum admissible weight.
|
231
|
+
|
232
|
+
```rb
|
233
|
+
puts result.document.inference.prediction.f1.value
|
234
|
+
```
|
235
|
+
|
236
|
+
## f2
|
237
|
+
**f2** ([StringField](#string-field)): The vehicle's maximum admissible weight within the license's state.
|
238
|
+
|
239
|
+
```rb
|
240
|
+
puts result.document.inference.prediction.f2.value
|
241
|
+
```
|
242
|
+
|
243
|
+
## f3
|
244
|
+
**f3** ([StringField](#string-field)): The vehicle's maximum authorized weight with coupling.
|
245
|
+
|
246
|
+
```rb
|
247
|
+
puts result.document.inference.prediction.f3.value
|
248
|
+
```
|
249
|
+
|
250
|
+
## Formula Number
|
251
|
+
**formula_number** ([StringField](#string-field)): The document's formula number.
|
252
|
+
|
253
|
+
```rb
|
254
|
+
puts result.document.inference.prediction.formula_number.value
|
255
|
+
```
|
256
|
+
|
257
|
+
## g
|
258
|
+
**g** ([StringField](#string-field)): The vehicle's weight with coupling if tractor different than category M1.
|
259
|
+
|
260
|
+
```rb
|
261
|
+
puts result.document.inference.prediction.g.value
|
262
|
+
```
|
263
|
+
|
264
|
+
## g1
|
265
|
+
**g1** ([StringField](#string-field)): The vehicle's national empty weight.
|
266
|
+
|
267
|
+
```rb
|
268
|
+
puts result.document.inference.prediction.g1.value
|
269
|
+
```
|
270
|
+
|
271
|
+
## i
|
272
|
+
**i** ([DateField](#date-field)): The car registration date of the given certificate.
|
273
|
+
|
274
|
+
```rb
|
275
|
+
puts result.document.inference.prediction.i.value
|
276
|
+
```
|
277
|
+
|
278
|
+
## j
|
279
|
+
**j** ([StringField](#string-field)): The vehicle's category.
|
280
|
+
|
281
|
+
```rb
|
282
|
+
puts result.document.inference.prediction.j.value
|
283
|
+
```
|
284
|
+
|
285
|
+
## j1
|
286
|
+
**j1** ([StringField](#string-field)): The vehicle's national type.
|
287
|
+
|
288
|
+
```rb
|
289
|
+
puts result.document.inference.prediction.j1.value
|
290
|
+
```
|
291
|
+
|
292
|
+
## j2
|
293
|
+
**j2** ([StringField](#string-field)): The vehicle's body type (CE).
|
294
|
+
|
295
|
+
```rb
|
296
|
+
puts result.document.inference.prediction.j2.value
|
297
|
+
```
|
298
|
+
|
299
|
+
## j3
|
300
|
+
**j3** ([StringField](#string-field)): The vehicle's body type (National designation).
|
301
|
+
|
302
|
+
```rb
|
303
|
+
puts result.document.inference.prediction.j3.value
|
304
|
+
```
|
305
|
+
|
306
|
+
## MRZ Line 1
|
307
|
+
**mrz1** ([StringField](#string-field)): Machine Readable Zone, first line.
|
308
|
+
|
309
|
+
```rb
|
310
|
+
puts result.document.inference.prediction.mrz1.value
|
311
|
+
```
|
312
|
+
|
313
|
+
## MRZ Line 2
|
314
|
+
**mrz2** ([StringField](#string-field)): Machine Readable Zone, second line.
|
315
|
+
|
316
|
+
```rb
|
317
|
+
puts result.document.inference.prediction.mrz2.value
|
318
|
+
```
|
319
|
+
|
320
|
+
## Owner's First Name
|
321
|
+
**owner_first_name** ([StringField](#string-field)): The vehicle's owner first name.
|
322
|
+
|
323
|
+
```rb
|
324
|
+
puts result.document.inference.prediction.owner_first_name.value
|
325
|
+
```
|
326
|
+
|
327
|
+
## Owner's Surname
|
328
|
+
**owner_surname** ([StringField](#string-field)): The vehicle's owner surname.
|
329
|
+
|
330
|
+
```rb
|
331
|
+
puts result.document.inference.prediction.owner_surname.value
|
332
|
+
```
|
333
|
+
|
334
|
+
## p1
|
335
|
+
**p1** ([StringField](#string-field)): The vehicle engine's displacement (cm3).
|
336
|
+
|
337
|
+
```rb
|
338
|
+
puts result.document.inference.prediction.p1.value
|
339
|
+
```
|
340
|
+
|
341
|
+
## p2
|
342
|
+
**p2** ([StringField](#string-field)): The vehicle's maximum net power (kW).
|
343
|
+
|
344
|
+
```rb
|
345
|
+
puts result.document.inference.prediction.p2.value
|
346
|
+
```
|
347
|
+
|
348
|
+
## p3
|
349
|
+
**p3** ([StringField](#string-field)): The vehicle's fuel type or energy source.
|
350
|
+
|
351
|
+
```rb
|
352
|
+
puts result.document.inference.prediction.p3.value
|
353
|
+
```
|
354
|
+
|
355
|
+
## p6
|
356
|
+
**p6** ([StringField](#string-field)): The vehicle's administrative power (fiscal horsepower).
|
357
|
+
|
358
|
+
```rb
|
359
|
+
puts result.document.inference.prediction.p6.value
|
360
|
+
```
|
361
|
+
|
362
|
+
## q
|
363
|
+
**q** ([StringField](#string-field)): The vehicle's power to weight ratio.
|
364
|
+
|
365
|
+
```rb
|
366
|
+
puts result.document.inference.prediction.q.value
|
367
|
+
```
|
368
|
+
|
369
|
+
## s1
|
370
|
+
**s1** ([StringField](#string-field)): The vehicle's number of seats.
|
371
|
+
|
372
|
+
```rb
|
373
|
+
puts result.document.inference.prediction.s1.value
|
374
|
+
```
|
375
|
+
|
376
|
+
## s2
|
377
|
+
**s2** ([StringField](#string-field)): The vehicle's number of standing rooms (person).
|
378
|
+
|
379
|
+
```rb
|
380
|
+
puts result.document.inference.prediction.s2.value
|
381
|
+
```
|
382
|
+
|
383
|
+
## u1
|
384
|
+
**u1** ([StringField](#string-field)): The vehicle's sound level (dB).
|
385
|
+
|
386
|
+
```rb
|
387
|
+
puts result.document.inference.prediction.u1.value
|
388
|
+
```
|
389
|
+
|
390
|
+
## u2
|
391
|
+
**u2** ([StringField](#string-field)): The vehicle engine's rotation speed (RPM).
|
392
|
+
|
393
|
+
```rb
|
394
|
+
puts result.document.inference.prediction.u2.value
|
395
|
+
```
|
396
|
+
|
397
|
+
## v7
|
398
|
+
**v7** ([StringField](#string-field)): The vehicle's CO2 emission (g/km).
|
399
|
+
|
400
|
+
```rb
|
401
|
+
puts result.document.inference.prediction.v7.value
|
402
|
+
```
|
403
|
+
|
404
|
+
## x1
|
405
|
+
**x1** ([StringField](#string-field)): Next technical control date.
|
406
|
+
|
407
|
+
```rb
|
408
|
+
puts result.document.inference.prediction.x1.value
|
409
|
+
```
|
410
|
+
|
411
|
+
## y1
|
412
|
+
**y1** ([StringField](#string-field)): Amount of the regional proportional tax of the registration (in euros).
|
413
|
+
|
414
|
+
```rb
|
415
|
+
puts result.document.inference.prediction.y1.value
|
416
|
+
```
|
417
|
+
|
418
|
+
## y2
|
419
|
+
**y2** ([StringField](#string-field)): Amount of the additional parafiscal tax of the registration (in euros).
|
420
|
+
|
421
|
+
```rb
|
422
|
+
puts result.document.inference.prediction.y2.value
|
423
|
+
```
|
424
|
+
|
425
|
+
## y3
|
426
|
+
**y3** ([StringField](#string-field)): Amount of the additional CO2 tax of the registration (in euros).
|
427
|
+
|
428
|
+
```rb
|
429
|
+
puts result.document.inference.prediction.y3.value
|
430
|
+
```
|
431
|
+
|
432
|
+
## y4
|
433
|
+
**y4** ([StringField](#string-field)): Amount of the fee for managing the registration (in euros).
|
434
|
+
|
435
|
+
```rb
|
436
|
+
puts result.document.inference.prediction.y4.value
|
437
|
+
```
|
438
|
+
|
439
|
+
## y5
|
440
|
+
**y5** ([StringField](#string-field)): Amount of the fee for delivery of the registration certificate in euros.
|
441
|
+
|
442
|
+
```rb
|
443
|
+
puts result.document.inference.prediction.y5.value
|
444
|
+
```
|
445
|
+
|
446
|
+
## y6
|
447
|
+
**y6** ([StringField](#string-field)): Total amount of registration fee to be paid in euros.
|
448
|
+
|
449
|
+
```rb
|
450
|
+
puts result.document.inference.prediction.y6.value
|
451
|
+
```
|
452
|
+
|
453
|
+
# Questions?
|
454
|
+
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'mindee'
|
2
|
+
|
3
|
+
# Init a new client
|
4
|
+
mindee_client = Mindee::Client.new(api_key: 'my-api-key')
|
5
|
+
|
6
|
+
# Load a file from disk
|
7
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
8
|
+
|
9
|
+
# Parse the file
|
10
|
+
result = mindee_client.parse(
|
11
|
+
input_source,
|
12
|
+
Mindee::Product::FR::CarteGrise::CarteGriseV1
|
13
|
+
)
|
14
|
+
|
15
|
+
# Print a full summary of the parsed data in RST format
|
16
|
+
puts result.document
|
17
|
+
|
18
|
+
# Print the document-level parsed data
|
19
|
+
# puts result.document.inference.prediction
|
data/docs/cropper_v1.md
CHANGED
data/docs/custom_v1.md
CHANGED
@@ -59,14 +59,22 @@ If it is not set, it will default to "1".
|
|
59
59
|
A `ListField` is a special type of custom list that implements the following:
|
60
60
|
|
61
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
62
|
* **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
|
63
|
+
* **values** (`Array<`[ListFieldItem](#list-field-item)`>`): list of value fields
|
64
64
|
|
65
65
|
Since the inner contents can vary, the value isn't accessed through a property, but rather through the following functions:
|
66
66
|
* **contents_list()** (`[Array, Hash, String, nil]`): returns a list of values for each element.
|
67
67
|
* **contents_str(separator:' ')** (`String`): returns a list of concatenated values, with an optional **separator** `String` between them.
|
68
68
|
* **to_s()**: returns a string representation of all values, with an empty space between each of them.
|
69
69
|
|
70
|
+
#### List Field Item
|
71
|
+
|
72
|
+
Values of `ListField`s are stored in a `ListFieldItem` structure, which is implemented as follows:
|
73
|
+
* **content** (`String`): extracted content of the prediction
|
74
|
+
* **confidence** (`Float`): the confidence score of the prediction
|
75
|
+
* **bounding_box** (`Quadrilateral`): 4 relative vertices corrdinates of a rectangle containing the word in the document.
|
76
|
+
* **polygon** (`Polygon`): vertices of a polygon containing the word.
|
77
|
+
* **page_id** (`Integer`): the ID of the page, is `nil` when at document-level.
|
70
78
|
|
71
79
|
### Classification Field
|
72
80
|
|
data/docs/expense_receipts_v5.md
CHANGED
@@ -159,7 +159,7 @@ The text field `StringField` only has one constraint: it's **value** is a `Strin
|
|
159
159
|
#### Tax
|
160
160
|
Aside from the basic `Field` attributes, the tax field `TaxField` also implements the following:
|
161
161
|
|
162
|
-
* **rate** (`Float`): the tax rate applied to an item can be
|
162
|
+
* **rate** (`Float`): the tax rate applied to an item can be expressed as a percentage. Can be `nil`.
|
163
163
|
* **code** (`String`): tax code (or equivalent, depending on the origin of the document). Can be `nil`.
|
164
164
|
* **base** (`Float`): base amount used for the tax. Can be `nil`.
|
165
165
|
|
@@ -58,11 +58,11 @@ Prediction
|
|
58
58
|
| | TAX | | 3.34 |
|
59
59
|
+---------------+--------+----------+---------------+
|
60
60
|
:Supplier Payment Details:
|
61
|
-
:Supplier
|
61
|
+
:Supplier Name: LOGANS
|
62
62
|
:Supplier Company Registrations:
|
63
63
|
:Supplier Address: 2513 s stemmons freeway lewisville tx 75067
|
64
64
|
:Supplier Phone Number: 9724596042
|
65
|
-
:Customer
|
65
|
+
:Customer Name:
|
66
66
|
:Customer Company Registrations:
|
67
67
|
:Customer Address:
|
68
68
|
:Document Type: EXPENSE RECEIPT
|
@@ -97,11 +97,11 @@ Page 0
|
|
97
97
|
| | TAX | | 3.34 |
|
98
98
|
+---------------+--------+----------+---------------+
|
99
99
|
:Supplier Payment Details:
|
100
|
-
:Supplier
|
100
|
+
:Supplier Name: LOGANS
|
101
101
|
:Supplier Company Registrations:
|
102
102
|
:Supplier Address: 2513 s stemmons freeway lewisville tx 75067
|
103
103
|
:Supplier Phone Number: 9724596042
|
104
|
-
:Customer
|
104
|
+
:Customer Name:
|
105
105
|
:Customer Company Registrations:
|
106
106
|
:Customer Address:
|
107
107
|
:Document Type: EXPENSE RECEIPT
|
@@ -179,7 +179,7 @@ The text field `StringField` only has one constraint: it's **value** is a `Strin
|
|
179
179
|
#### Tax
|
180
180
|
Aside from the basic `Field` attributes, the tax field `TaxField` also implements the following:
|
181
181
|
|
182
|
-
* **rate** (`Float`): the tax rate applied to an item can be
|
182
|
+
* **rate** (`Float`): the tax rate applied to an item can be expressed as a percentage. Can be `nil`.
|
183
183
|
* **code** (`String`): tax code (or equivalent, depending on the origin of the document). Can be `nil`.
|
184
184
|
* **base** (`Float`): base amount used for the tax. Can be `nil`.
|
185
185
|
|
@@ -313,7 +313,7 @@ for supplier_company_registrations_elem in result.document.inference.prediction.
|
|
313
313
|
end
|
314
314
|
```
|
315
315
|
|
316
|
-
## Supplier
|
316
|
+
## Supplier Name
|
317
317
|
**supplier_name** ([StringField](#string-field)): The name of the supplier or merchant.
|
318
318
|
|
319
319
|
```rb
|