mindee 4.7.2 → 4.8.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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +6 -6
  4. data/Rakefile +1 -0
  5. data/lib/mindee/errors/mindee_http_error_v2.rb +23 -4
  6. data/lib/mindee/errors/mindee_http_unknown_error_v2.rb +18 -0
  7. data/lib/mindee/http/endpoint.rb +1 -0
  8. data/lib/mindee/parsing/v2/error_item.rb +21 -0
  9. data/lib/mindee/parsing/v2/error_response.rb +18 -3
  10. data/lib/mindee/parsing/v2/inference_result.rb +4 -0
  11. data/lib/mindee/parsing/v2/rag_metadata.rb +17 -0
  12. data/lib/mindee/version.rb +1 -1
  13. data/mindee.gemspec +1 -0
  14. data/sig/mindee/errors/mindee_http_error_v2.rbs +4 -1
  15. data/sig/mindee/errors/mindee_http_unknown_error_v2.rbs +9 -0
  16. data/sig/mindee/http/endpoint.rbs +1 -0
  17. data/sig/mindee/parsing/v2/error_item.rbs +13 -0
  18. data/sig/mindee/parsing/v2/error_response.rbs +3 -0
  19. data/sig/mindee/parsing/v2/inference_result.rbs +1 -0
  20. data/sig/mindee/parsing/v2/rag_metadata.rbs +13 -0
  21. metadata +22 -34
  22. data/docs/advanced_file_operations.md +0 -109
  23. data/docs/getting_started.md +0 -257
  24. data/docs/global_products/barcode_reader_v1.md +0 -125
  25. data/docs/global_products/bill_of_lading_v1.md +0 -276
  26. data/docs/global_products/business_card_v1.md +0 -194
  27. data/docs/global_products/cropper_v1.md +0 -123
  28. data/docs/global_products/delivery_notes_v1.md +0 -168
  29. data/docs/global_products/driver_license_v1.md +0 -212
  30. data/docs/global_products/expense_receipts_v5.md +0 -415
  31. data/docs/global_products/financial_document_v1.md +0 -615
  32. data/docs/global_products/international_id_v2.md +0 -264
  33. data/docs/global_products/invoice_splitter_v1.md +0 -127
  34. data/docs/global_products/invoices_v4.md +0 -576
  35. data/docs/global_products/multi_receipts_detector_v1.md +0 -131
  36. data/docs/global_products/nutrition_facts_v1.md +0 -399
  37. data/docs/global_products/passport_v1.md +0 -207
  38. data/docs/global_products/resume_v1.md +0 -384
  39. data/docs/global_products/universal.md +0 -113
  40. data/docs/global_products.md +0 -6
  41. data/docs/loading_a_document.md +0 -330
  42. data/docs/localized_products/bank_account_details_v2.md +0 -158
  43. data/docs/localized_products/bank_check_v1.md +0 -205
  44. data/docs/localized_products/bank_statement_fr_v2.md +0 -269
  45. data/docs/localized_products/carte_grise_v1.md +0 -475
  46. data/docs/localized_products/energy_bill_fra_v1.md +0 -342
  47. data/docs/localized_products/french_healthcard_v1.md +0 -142
  48. data/docs/localized_products/idcard_fr_v2.md +0 -284
  49. data/docs/localized_products/ind_passport_v1.md +0 -307
  50. data/docs/localized_products/payslip_fra_v3.md +0 -344
  51. data/docs/localized_products/us_healthcare_cards_v1.md +0 -258
  52. data/docs/localized_products/us_mail_v3.md +0 -152
  53. data/docs/localized_products.md +0 -6
@@ -1,384 +0,0 @@
1
- ---
2
- title: Resume
3
- category: 622b805aaec68102ea7fcbc2
4
- slug: ruby-resume-ocr
5
- parentDoc: 67b49df15b843f3fa9cd622b
6
- ---
7
- The Ruby Client Library supports the [Resume API](https://platform.mindee.com/mindee/resume).
8
-
9
-
10
- > 📝 Product Specs
11
- >
12
- > | Specification | Details |
13
- > | ------------------------------ | -------------------------------------------------- |
14
- > | Endpoint Name | `resume` |
15
- > | Recommended Version | `v1.2` |
16
- > | Supports Polling/Webhooks | ✔️ Yes |
17
- > | Support Synchronous HTTP Calls | ❌ No |
18
- > | Geography | 🌐 Global |
19
-
20
- > 🔐 Polling Limitations
21
- >
22
- > | Setting | Parameter name | Default Value |
23
- > | ------------------------------- | ----------------------- | ------------- |
24
- > | Initial Delay Before Polling | `initial_delay_seconds` | 2 seconds |
25
- > | Default Delay Between Calls | `delay_sec` | 1.5 seconds |
26
- > | Polling Attempts Before Timeout | `max_retries` | 80 retries |
27
-
28
-
29
- Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/resume/default_sample.jpg),
30
- we are going to illustrate how to extract the data that we want using the Ruby Client Library.
31
- ![Resume sample](https://github.com/mindee/client-lib-test-data/blob/main/products/resume/default_sample.jpg?raw=true)
32
-
33
- # Quick-Start
34
- ```rb
35
- #
36
- # Install the Ruby client library by running:
37
- # gem install mindee
38
- #
39
-
40
- require 'mindee'
41
-
42
- # Init a new client
43
- mindee_client = Mindee::Client.new(api_key: 'my-api-key')
44
-
45
- # Load a file from disk
46
- input_source = mindee_client.source_from_path('/path/to/the/file.ext')
47
-
48
- # Parse the file
49
- result = mindee_client.parse(
50
- input_source,
51
- Mindee::Product::Resume::ResumeV1
52
- )
53
-
54
- # Print a full summary of the parsed data in RST format
55
- puts result.document
56
-
57
- # Print the document-level parsed data
58
- # puts result.document.inference.prediction
59
- ```
60
-
61
- **Output (RST):**
62
- ```rst
63
- ########
64
- Document
65
- ########
66
- :Mindee ID: 9daa3085-152c-454e-9245-636f13fc9dc3
67
- :Filename: default_sample.jpg
68
-
69
- Inference
70
- #########
71
- :Product: mindee/resume v1.1
72
- :Rotation applied: Yes
73
-
74
- Prediction
75
- ==========
76
- :Document Language: ENG
77
- :Document Type: RESUME
78
- :Given Names: Christopher
79
- :Surnames: Morgan
80
- :Nationality:
81
- :Email Address: christoper.m@gmail.com
82
- :Phone Number: +44 (0)20 7666 8555
83
- :Address: 177 Great Portland Street, London, W5W 6PQ
84
- :Social Networks:
85
- +----------------------+----------------------------------------------------+
86
- | Name | URL |
87
- +======================+====================================================+
88
- | LinkedIn | linkedin.com/christopher.morgan |
89
- +----------------------+----------------------------------------------------+
90
- :Profession: Senior Web Developer
91
- :Job Applied:
92
- :Languages:
93
- +----------+----------------------+
94
- | Language | Level |
95
- +==========+======================+
96
- | SPA | Fluent |
97
- +----------+----------------------+
98
- | ZHO | Beginner |
99
- +----------+----------------------+
100
- | DEU | Beginner |
101
- +----------+----------------------+
102
- :Hard Skills: HTML5
103
- PHP OOP
104
- JavaScript
105
- CSS
106
- MySQL
107
- SQL
108
- :Soft Skills: Project management
109
- Creative design
110
- Strong decision maker
111
- Innovative
112
- Complex problem solver
113
- Service-focused
114
- :Education:
115
- +-----------------+---------------------------+-----------+----------+---------------------------+-------------+------------+
116
- | Domain | Degree | End Month | End Year | School | Start Month | Start Year |
117
- +=================+===========================+===========+==========+===========================+=============+============+
118
- | Computer Inf... | Bachelor | | 2014 | Columbia University, NY | | |
119
- +-----------------+---------------------------+-----------+----------+---------------------------+-------------+------------+
120
- :Professional Experiences:
121
- +-----------------+------------+--------------------------------------+---------------------------+-----------+----------+----------------------+-------------+------------+
122
- | Contract Type | Department | Description | Employer | End Month | End Year | Role | Start Month | Start Year |
123
- +=================+============+======================================+===========================+===========+==========+======================+=============+============+
124
- | | | Cooperate with designers to creat... | Luna Web Design, New York | 05 | 2019 | Web Developer | 09 | 2015 |
125
- +-----------------+------------+--------------------------------------+---------------------------+-----------+----------+----------------------+-------------+------------+
126
- :Certificates:
127
- +------------+--------------------------------+---------------------------+------+
128
- | Grade | Name | Provider | Year |
129
- +============+================================+===========================+======+
130
- | | PHP Framework (certificate)... | | |
131
- +------------+--------------------------------+---------------------------+------+
132
- ```
133
-
134
- # Field Types
135
- ## Standard Fields
136
- These fields are generic and used in several products.
137
-
138
- ### Basic Field
139
- Each prediction object contains a set of fields that inherit from the generic `Field` class.
140
- A typical `Field` object will have the following attributes:
141
-
142
- * **value** (`String`, `Float`, `Integer`, `bool`): corresponds to the field value. Can be `nil` if no value was extracted.
143
- * **confidence** (Float, nil): the confidence score of the field prediction.
144
- * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
145
- * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
146
- * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
147
- * **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it).
148
-
149
-
150
- 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.
151
-
152
-
153
- ### Classification Field
154
- The classification field `ClassificationField` does not implement all the basic `Field` attributes. It only implements
155
- **value**, **confidence** and **page_id**.
156
-
157
- > Note: a classification field's `value is always a `String`.
158
-
159
- ### String Field
160
- The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
161
-
162
- ## Specific Fields
163
- Fields which are specific to this product; they are not used in any other product.
164
-
165
- ### Social Networks Field
166
- The list of social network profiles of the candidate.
167
-
168
- A `ResumeV1SocialNetworksUrl` implements the following attributes:
169
-
170
- * `name` (String): The name of the social network.
171
- * `url` (String): The URL of the social network.
172
- Fields which are specific to this product; they are not used in any other product.
173
-
174
- ### Languages Field
175
- The list of languages that the candidate is proficient in.
176
-
177
- A `ResumeV1Language` implements the following attributes:
178
-
179
- * `language` (String): The language's ISO 639 code.
180
- * `level` (String): The candidate's level for the language.
181
-
182
- #### Possible values include:
183
- - Native
184
- - Fluent
185
- - Proficient
186
- - Intermediate
187
- - Beginner
188
-
189
- Fields which are specific to this product; they are not used in any other product.
190
-
191
- ### Education Field
192
- The list of the candidate's educational background.
193
-
194
- A `ResumeV1Education` implements the following attributes:
195
-
196
- * `degree_domain` (String): The area of study or specialization.
197
- * `degree_type` (String): The type of degree obtained, such as Bachelor's, Master's, or Doctorate.
198
- * `end_month` (String): The month when the education program or course was completed.
199
- * `end_year` (String): The year when the education program or course was completed.
200
- * `school` (String): The name of the school.
201
- * `start_month` (String): The month when the education program or course began.
202
- * `start_year` (String): The year when the education program or course began.
203
- Fields which are specific to this product; they are not used in any other product.
204
-
205
- ### Professional Experiences Field
206
- The list of the candidate's professional experiences.
207
-
208
- A `ResumeV1ProfessionalExperience` implements the following attributes:
209
-
210
- * `contract_type` (String): The type of contract for the professional experience.
211
-
212
- #### Possible values include:
213
- - Full-Time
214
- - Part-Time
215
- - Internship
216
- - Freelance
217
-
218
- * `department` (String): The specific department or division within the company.
219
- * `description` (String): The description of the professional experience as written in the document.
220
- * `employer` (String): The name of the company or organization.
221
- * `end_month` (String): The month when the professional experience ended.
222
- * `end_year` (String): The year when the professional experience ended.
223
- * `role` (String): The position or job title held by the candidate.
224
- * `start_month` (String): The month when the professional experience began.
225
- * `start_year` (String): The year when the professional experience began.
226
- Fields which are specific to this product; they are not used in any other product.
227
-
228
- ### Certificates Field
229
- The list of certificates obtained by the candidate.
230
-
231
- A `ResumeV1Certificate` implements the following attributes:
232
-
233
- * `grade` (String): The grade obtained for the certificate.
234
- * `name` (String): The name of certification.
235
- * `provider` (String): The organization or institution that issued the certificate.
236
- * `year` (String): The year when a certificate was issued or received.
237
-
238
- # Attributes
239
- The following fields are extracted for Resume V1:
240
-
241
- ## Address
242
- **address** ([StringField](#string-field)): The location information of the candidate, including city, state, and country.
243
-
244
- ```rb
245
- puts result.document.inference.prediction.address.value
246
- ```
247
-
248
- ## Certificates
249
- **certificates** (Array<[ResumeV1Certificate](#certificates-field)>): The list of certificates obtained by the candidate.
250
-
251
- ```rb
252
- result.document.inference.prediction.certificates do |certificates_elem|
253
- puts certificates_elem.value
254
- end
255
- ```
256
-
257
- ## Document Language
258
- **document_language** ([StringField](#string-field)): The ISO 639 code of the language in which the document is written.
259
-
260
- ```rb
261
- puts result.document.inference.prediction.document_language.value
262
- ```
263
-
264
- ## Document Type
265
- **document_type** ([ClassificationField](#classification-field)): The type of the document sent.
266
-
267
- #### Possible values include:
268
- - 'RESUME'
269
- - 'MOTIVATION_LETTER'
270
- - 'RECOMMENDATION_LETTER'
271
-
272
- ```rb
273
- puts result.document.inference.prediction.document_type.value
274
- ```
275
-
276
- ## Education
277
- **education** (Array<[ResumeV1Education](#education-field)>): The list of the candidate's educational background.
278
-
279
- ```rb
280
- result.document.inference.prediction.education do |education_elem|
281
- puts education_elem.value
282
- end
283
- ```
284
-
285
- ## Email Address
286
- **email_address** ([StringField](#string-field)): The email address of the candidate.
287
-
288
- ```rb
289
- puts result.document.inference.prediction.email_address.value
290
- ```
291
-
292
- ## Given Names
293
- **given_names** (Array<[StringField](#string-field)>): The candidate's first or given names.
294
-
295
- ```rb
296
- result.document.inference.prediction.given_names do |given_names_elem|
297
- puts given_names_elem.value
298
- end
299
- ```
300
-
301
- ## Hard Skills
302
- **hard_skills** (Array<[StringField](#string-field)>): The list of the candidate's technical abilities and knowledge.
303
-
304
- ```rb
305
- result.document.inference.prediction.hard_skills do |hard_skills_elem|
306
- puts hard_skills_elem.value
307
- end
308
- ```
309
-
310
- ## Job Applied
311
- **job_applied** ([StringField](#string-field)): The position that the candidate is applying for.
312
-
313
- ```rb
314
- puts result.document.inference.prediction.job_applied.value
315
- ```
316
-
317
- ## Languages
318
- **languages** (Array<[ResumeV1Language](#languages-field)>): The list of languages that the candidate is proficient in.
319
-
320
- ```rb
321
- result.document.inference.prediction.languages do |languages_elem|
322
- puts languages_elem.value
323
- end
324
- ```
325
-
326
- ## Nationality
327
- **nationality** ([StringField](#string-field)): The ISO 3166 code for the country of citizenship of the candidate.
328
-
329
- ```rb
330
- puts result.document.inference.prediction.nationality.value
331
- ```
332
-
333
- ## Phone Number
334
- **phone_number** ([StringField](#string-field)): The phone number of the candidate.
335
-
336
- ```rb
337
- puts result.document.inference.prediction.phone_number.value
338
- ```
339
-
340
- ## Profession
341
- **profession** ([StringField](#string-field)): The candidate's current profession.
342
-
343
- ```rb
344
- puts result.document.inference.prediction.profession.value
345
- ```
346
-
347
- ## Professional Experiences
348
- **professional_experiences** (Array<[ResumeV1ProfessionalExperience](#professional-experiences-field)>): The list of the candidate's professional experiences.
349
-
350
- ```rb
351
- result.document.inference.prediction.professional_experiences do |professional_experiences_elem|
352
- puts professional_experiences_elem.value
353
- end
354
- ```
355
-
356
- ## Social Networks
357
- **social_networks_urls** (Array<[ResumeV1SocialNetworksUrl](#social-networks-field)>): The list of social network profiles of the candidate.
358
-
359
- ```rb
360
- result.document.inference.prediction.social_networks_urls do |social_networks_urls_elem|
361
- puts social_networks_urls_elem.value
362
- end
363
- ```
364
-
365
- ## Soft Skills
366
- **soft_skills** (Array<[StringField](#string-field)>): The list of the candidate's interpersonal and communication abilities.
367
-
368
- ```rb
369
- result.document.inference.prediction.soft_skills do |soft_skills_elem|
370
- puts soft_skills_elem.value
371
- end
372
- ```
373
-
374
- ## Surnames
375
- **surnames** (Array<[StringField](#string-field)>): The candidate's last names.
376
-
377
- ```rb
378
- result.document.inference.prediction.surnames do |surnames_elem|
379
- puts surnames_elem.value
380
- end
381
- ```
382
-
383
- # Questions?
384
- [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
@@ -1,113 +0,0 @@
1
- ---
2
- title: Universal
3
- category: 622b805aaec68102ea7fcbc2
4
- slug: ruby-universal-ocr
5
- parentDoc: 67b49df15b843f3fa9cd622b
6
- ---
7
- The Ruby Client Library implements a universal wrapper class for all products.
8
-
9
- > 📝 Product Specs
10
- >
11
- > | Specification | Details |
12
- > | ------------------------------ |-----------------------------------------------------------------|
13
- > | Endpoint Name | `<name_of_the_endpoint>` |
14
- > | Recommended Version | `v<version_of_the_endpoint>` Defaults to 1 for custom products. |
15
- > | Supports Polling/Webhooks | ❓️ Variable |
16
- > | Support Synchronous HTTP Calls | ❓ Variable |
17
- > | Geography | ❓ Variable |
18
-
19
- > 🔐 Polling Limitations
20
- >
21
- > | Setting | Parameter name | Default Value |
22
- > | ------------------------------- | ----------------------- |---------------|
23
- > | Initial Delay Before Polling | `initial_delay_seconds` | 2 seconds |
24
- > | Default Delay Between Calls | `delay_sec` | 1.5 seconds |
25
- > | Polling Attempts Before Timeout | `max_retries` | 80 retries |
26
-
27
- The `Universal` product supports all products in a catch-all generic format, and can be used in the following manner:
28
-
29
- # Quick-Start
30
-
31
- ```rb
32
- require 'mindee'
33
-
34
- # Init a new client
35
- mindee_client = Mindee::Client.new(api_key: 'my-api-key')
36
-
37
- # Load a file from disk
38
- input_source = mindee_client.source_from_path('/path/to/the/file.ext')
39
-
40
- # Initialize a custom endpoint for this product
41
- custom_endpoint = mindee_client.create_endpoint(
42
- account_name: 'my-account',
43
- endpoint_name: 'my-endpoint',
44
- version: 'my-version'
45
- )
46
-
47
- # Parse the file
48
- result = mindee_client.parse(
49
- input_source,
50
- Mindee::Product::Universal::Universal,
51
- endpoint: custom_endpoint
52
- # Note: On compatible APIs, you can run this HTTP call synchronously by setting `enqueue: false`
53
- )
54
-
55
- # Print a full summary of the parsed data in RST format
56
- puts result.document
57
- ```
58
-
59
- # Universal Endpoints
60
-
61
- You may have noticed in the previous step that in order to access a universal build, you will need to provide an account and an endpoint name at the very least.
62
-
63
- Although it is optional, the version number should match the latest version of your build in most use-cases.
64
- If it is not set, it will default to "1".
65
-
66
- # Field Types
67
-
68
- ## Universal Fields
69
-
70
- ### Universal List Field
71
-
72
- A `UniversalListField` is a special type of custom list that implements the following:
73
-
74
- - **values** (`Array<StringField`[UniversalObjectField](#universal-object-field)`>`): the confidence score of the field prediction.
75
- - **page_id** (`Integer`): only available for some documents ATM.
76
-
77
- Since the inner contents can vary, the value isn't accessed through a property, but rather through the following functions:
78
-
79
- - **contents_list()** (`-> Array<String, Float>>`): returns a list of values for each element.
80
- - **contents_string(separator=" ")** (`-> String`): returns a list of concatenated values, with an optional **separator** `String` between them.
81
- > **Note:** the `to_s` method returns a string representation of all values of this object, with an empty space between each of them.
82
-
83
- ### Universal Object Field
84
-
85
- Unrecognized structures and sometimes values of `ListField`s are stored in a `UniversalObjectField` structure, which is implemented dynamically depending on the object's structure.
86
-
87
- - **page_id** (`[Integer, nil]`): the ID of the page, is `nil` when at document-level.
88
- - **raw_value** (`[String, nil]`): an optional field for when some post-processing has been done on fields (e.g. amounts). `nil` in most instances.
89
- - **confidence** (`[Float, nil]`): the confidence score of the field prediction. Warning: support isn't guaranteed on all APIs.
90
-
91
-
92
- > **Other fields**:No matter what, other fields will be stored in a dictionary-like structure with a `key: value` pair where `key` is a string and `value` is a nullable string. They can be accessed like any other regular value, but won't be suggested by your IDE.
93
-
94
-
95
- ### StringField
96
- The text field `StringField` only has one constraint: its **value** is an `Optional[str]`.
97
-
98
-
99
- # Attributes
100
-
101
- Universal builds always have access to at least two attributes:
102
-
103
- ## Fields
104
-
105
- **fields** (`Hash<String, Array<`[UniversalListField](#universal-list-field),[UniversalObjectField](#universal-object-field), `(#stringfield)[StringField]>>`):
106
-
107
- ```rb
108
- puts result.document.inference.prediction.fields["my-field"].to_s
109
- ```
110
-
111
- # Questions?
112
-
113
- [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
@@ -1,6 +0,0 @@
1
- ---
2
- title: Global Products
3
- category: 622b805aaec68102ea7fcbc2
4
- slug: ruby-global-products
5
- parentDoc: 6294d97ee723f1008d2ab28e
6
- ---