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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +6 -6
- data/Rakefile +1 -0
- data/lib/mindee/errors/mindee_http_error_v2.rb +23 -4
- data/lib/mindee/errors/mindee_http_unknown_error_v2.rb +18 -0
- data/lib/mindee/http/endpoint.rb +1 -0
- data/lib/mindee/parsing/v2/error_item.rb +21 -0
- data/lib/mindee/parsing/v2/error_response.rb +18 -3
- data/lib/mindee/parsing/v2/inference_result.rb +4 -0
- data/lib/mindee/parsing/v2/rag_metadata.rb +17 -0
- data/lib/mindee/version.rb +1 -1
- data/mindee.gemspec +1 -0
- data/sig/mindee/errors/mindee_http_error_v2.rbs +4 -1
- data/sig/mindee/errors/mindee_http_unknown_error_v2.rbs +9 -0
- data/sig/mindee/http/endpoint.rbs +1 -0
- data/sig/mindee/parsing/v2/error_item.rbs +13 -0
- data/sig/mindee/parsing/v2/error_response.rbs +3 -0
- data/sig/mindee/parsing/v2/inference_result.rbs +1 -0
- data/sig/mindee/parsing/v2/rag_metadata.rbs +13 -0
- metadata +22 -34
- data/docs/advanced_file_operations.md +0 -109
- data/docs/getting_started.md +0 -257
- data/docs/global_products/barcode_reader_v1.md +0 -125
- data/docs/global_products/bill_of_lading_v1.md +0 -276
- data/docs/global_products/business_card_v1.md +0 -194
- data/docs/global_products/cropper_v1.md +0 -123
- data/docs/global_products/delivery_notes_v1.md +0 -168
- data/docs/global_products/driver_license_v1.md +0 -212
- data/docs/global_products/expense_receipts_v5.md +0 -415
- data/docs/global_products/financial_document_v1.md +0 -615
- data/docs/global_products/international_id_v2.md +0 -264
- data/docs/global_products/invoice_splitter_v1.md +0 -127
- data/docs/global_products/invoices_v4.md +0 -576
- data/docs/global_products/multi_receipts_detector_v1.md +0 -131
- data/docs/global_products/nutrition_facts_v1.md +0 -399
- data/docs/global_products/passport_v1.md +0 -207
- data/docs/global_products/resume_v1.md +0 -384
- data/docs/global_products/universal.md +0 -113
- data/docs/global_products.md +0 -6
- data/docs/loading_a_document.md +0 -330
- data/docs/localized_products/bank_account_details_v2.md +0 -158
- data/docs/localized_products/bank_check_v1.md +0 -205
- data/docs/localized_products/bank_statement_fr_v2.md +0 -269
- data/docs/localized_products/carte_grise_v1.md +0 -475
- data/docs/localized_products/energy_bill_fra_v1.md +0 -342
- data/docs/localized_products/french_healthcard_v1.md +0 -142
- data/docs/localized_products/idcard_fr_v2.md +0 -284
- data/docs/localized_products/ind_passport_v1.md +0 -307
- data/docs/localized_products/payslip_fra_v3.md +0 -344
- data/docs/localized_products/us_healthcare_cards_v1.md +0 -258
- data/docs/localized_products/us_mail_v3.md +0 -152
- data/docs/localized_products.md +0 -6
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: US US Mail
|
|
3
|
-
category: 622b805aaec68102ea7fcbc2
|
|
4
|
-
slug: ruby-us-us-mail-ocr
|
|
5
|
-
parentDoc: 67b49e29a2cd6f08d69a40d8
|
|
6
|
-
---
|
|
7
|
-
The Ruby Client Library supports the [US Mail API](https://platform.mindee.com/mindee/us_mail).
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
> π Product Specs
|
|
11
|
-
>
|
|
12
|
-
> | Specification | Details |
|
|
13
|
-
> | ------------------------------ | -------------------------------------------------- |
|
|
14
|
-
> | Endpoint Name | `us_mail` |
|
|
15
|
-
> | Recommended Version | `v3.0` |
|
|
16
|
-
> | Supports Polling/Webhooks | βοΈ Yes |
|
|
17
|
-
> | Support Synchronous HTTP Calls | β No |
|
|
18
|
-
> | Geography | πΊπΈ United States |
|
|
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
|
-
The [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/us_mail/default_sample.jpg) can be used for testing purposes.
|
|
30
|
-

|
|
31
|
-
|
|
32
|
-
# Quick-Start
|
|
33
|
-
```rb
|
|
34
|
-
#
|
|
35
|
-
# Install the Ruby client library by running:
|
|
36
|
-
# gem install mindee
|
|
37
|
-
#
|
|
38
|
-
|
|
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.parse(
|
|
49
|
-
input_source,
|
|
50
|
-
Mindee::Product::US::UsMail::UsMailV3
|
|
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
|
-
```
|
|
59
|
-
# Field Types
|
|
60
|
-
## Standard Fields
|
|
61
|
-
These fields are generic and used in several products.
|
|
62
|
-
|
|
63
|
-
### Basic Field
|
|
64
|
-
Each prediction object contains a set of fields that inherit from the generic `Field` class.
|
|
65
|
-
A typical `Field` object will have the following attributes:
|
|
66
|
-
|
|
67
|
-
* **value** (`String`, `Float`, `Integer`, `bool`): corresponds to the field value. Can be `nil` if no value was extracted.
|
|
68
|
-
* **confidence** (Float, nil): the confidence score of the field prediction.
|
|
69
|
-
* **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
|
|
70
|
-
* **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
|
|
71
|
-
* **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
|
|
72
|
-
* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it).
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
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.
|
|
76
|
-
|
|
77
|
-
### String Field
|
|
78
|
-
The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
|
|
79
|
-
|
|
80
|
-
## Specific Fields
|
|
81
|
-
Fields which are specific to this product; they are not used in any other product.
|
|
82
|
-
|
|
83
|
-
### Sender Address Field
|
|
84
|
-
The address of the sender.
|
|
85
|
-
|
|
86
|
-
A `UsMailV3SenderAddress` implements the following attributes:
|
|
87
|
-
|
|
88
|
-
* `city` (String): The city of the sender's address.
|
|
89
|
-
* `complete` (String): The complete address of the sender.
|
|
90
|
-
* `postal_code` (String): The postal code of the sender's address.
|
|
91
|
-
* `state` (String): Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.
|
|
92
|
-
* `street` (String): The street of the sender's address.
|
|
93
|
-
Fields which are specific to this product; they are not used in any other product.
|
|
94
|
-
|
|
95
|
-
### Recipient Addresses Field
|
|
96
|
-
The addresses of the recipients.
|
|
97
|
-
|
|
98
|
-
A `UsMailV3RecipientAddress` implements the following attributes:
|
|
99
|
-
|
|
100
|
-
* `city` (String): The city of the recipient's address.
|
|
101
|
-
* `complete` (String): The complete address of the recipient.
|
|
102
|
-
* `is_address_change` (bool): Indicates if the recipient's address is a change of address.
|
|
103
|
-
* `postal_code` (String): The postal code of the recipient's address.
|
|
104
|
-
* `private_mailbox_number` (String): The private mailbox number of the recipient's address.
|
|
105
|
-
* `state` (String): Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.
|
|
106
|
-
* `street` (String): The street of the recipient's address.
|
|
107
|
-
* `unit` (String): The unit number of the recipient's address.
|
|
108
|
-
|
|
109
|
-
# Attributes
|
|
110
|
-
The following fields are extracted for US Mail V3:
|
|
111
|
-
|
|
112
|
-
## Return to Sender
|
|
113
|
-
**is_return_to_sender** ([BooleanField](#boolean-field)): Whether the mailing is marked as return to sender.
|
|
114
|
-
|
|
115
|
-
```rb
|
|
116
|
-
puts result.document.inference.prediction.is_return_to_sender.value
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## Recipient Addresses
|
|
120
|
-
**recipient_addresses** (Array<[UsMailV3RecipientAddress](#recipient-addresses-field)>): The addresses of the recipients.
|
|
121
|
-
|
|
122
|
-
```rb
|
|
123
|
-
result.document.inference.prediction.recipient_addresses do |recipient_addresses_elem|
|
|
124
|
-
puts recipient_addresses_elem.value
|
|
125
|
-
end
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
## Recipient Names
|
|
129
|
-
**recipient_names** (Array<[StringField](#string-field)>): The names of the recipients.
|
|
130
|
-
|
|
131
|
-
```rb
|
|
132
|
-
result.document.inference.prediction.recipient_names do |recipient_names_elem|
|
|
133
|
-
puts recipient_names_elem.value
|
|
134
|
-
end
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
## Sender Address
|
|
138
|
-
**sender_address** ([UsMailV3SenderAddress](#sender-address-field)): The address of the sender.
|
|
139
|
-
|
|
140
|
-
```rb
|
|
141
|
-
puts result.document.inference.prediction.sender_address.value
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## Sender Name
|
|
145
|
-
**sender_name** ([StringField](#string-field)): The name of the sender.
|
|
146
|
-
|
|
147
|
-
```rb
|
|
148
|
-
puts result.document.inference.prediction.sender_name.value
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
# Questions?
|
|
152
|
-
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
|