mindee 3.15.0 → 3.16.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 (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/docs/business_card_v1.md +169 -0
  4. data/docs/code_samples/business_card_v1_async.txt +19 -0
  5. data/docs/code_samples/delivery_notes_v1_async.txt +19 -0
  6. data/docs/code_samples/expense_receipts_v5_async.txt +19 -0
  7. data/docs/code_samples/ind_passport_v1_async.txt +19 -0
  8. data/docs/delivery_notes_v1.md +143 -0
  9. data/docs/energy_bill_fra_v1.md +2 -2
  10. data/docs/expense_receipts_v5.md +27 -2
  11. data/docs/financial_document_v1.md +8 -4
  12. data/docs/ind_passport_v1.md +281 -0
  13. data/docs/invoices_v4.md +12 -8
  14. data/docs/resume_v1.md +17 -16
  15. data/lib/mindee/client.rb +8 -8
  16. data/lib/mindee/product/business_card/business_card_v1.rb +39 -0
  17. data/lib/mindee/product/business_card/business_card_v1_document.rb +85 -0
  18. data/lib/mindee/product/business_card/business_card_v1_page.rb +32 -0
  19. data/lib/mindee/product/delivery_note/delivery_note_v1.rb +39 -0
  20. data/lib/mindee/product/delivery_note/delivery_note_v1_document.rb +61 -0
  21. data/lib/mindee/product/delivery_note/delivery_note_v1_page.rb +32 -0
  22. data/lib/mindee/product/financial_document/financial_document_v1_document.rb +1 -1
  23. data/lib/mindee/product/financial_document/financial_document_v1_page.rb +1 -1
  24. data/lib/mindee/product/ind/indian_passport/indian_passport_v1.rb +41 -0
  25. data/lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb +143 -0
  26. data/lib/mindee/product/ind/indian_passport/indian_passport_v1_page.rb +34 -0
  27. data/lib/mindee/product/invoice/invoice_v4_document.rb +1 -1
  28. data/lib/mindee/product/invoice/invoice_v4_page.rb +1 -1
  29. data/lib/mindee/product/resume/resume_v1_document.rb +3 -1
  30. data/lib/mindee/product/resume/resume_v1_page.rb +1 -1
  31. data/lib/mindee/product/resume/resume_v1_professional_experience.rb +8 -0
  32. data/lib/mindee/product.rb +10 -7
  33. data/lib/mindee/version.rb +1 -1
  34. metadata +18 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d356c6733d8a7d00973b219dbae06199040ca8d4bece4eb3906c8ec873aebf0
4
- data.tar.gz: ab240a95c8538891aa4a3ef48285903daa06cebaf13f9578eff1a9675258d3bb
3
+ metadata.gz: c91223f916a74a5224df6a5df5557d2fdebcfe4dd70c2a8ed76db1ab4b8abdda
4
+ data.tar.gz: 39667d73103146ce8fc1de4d49489a4be0062b5651cacb854334443ef0d90a0d
5
5
  SHA512:
6
- metadata.gz: ec71145b9604ba30c77a842a33c89c1ad4ab4c70301c3eed2292bc95803dd112ee99c964289ca88c16ddffcb6a37f63130b30a23326b4359929791d0dcef4214
7
- data.tar.gz: 0c20c191f6abe4166075a1745860ba500a488294bcb59e2a28e0b61a3bcee07a25be2adfef113d045727eeaf10f935278271a7d259f78d63e580bf8eda3833f3
6
+ metadata.gz: 5be6ee28449e4a74d99e2fb172e47fccb75fc11e92f233b35aec0c8fb50b76cca53054c47fd3edafa330a34dab080b10e680f94f086c98eef1a5bcbcc219c77d
7
+ data.tar.gz: 4d859af23946ad75890c6bca1bb947903c649dc31a3e37ff9b4557dd5b0ac999cd2ec4f9f81c09d584d033a61b6adb743130ea3be9e08da89df6e507280f9a22
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Mindee Ruby API Library Changelog
2
2
 
3
+ ## v3.16.0 - 2024-11-14
4
+ ### Changes
5
+ * :sparkles: add support for business cards V1
6
+ * :sparkles: add support for delivery note V1.1
7
+ * :sparkles: add support for indian passport V1
8
+ * :sparkles: add support for resume V1.1
9
+ ### Fixes
10
+ * :recycle: adjust default values for async delays
11
+
12
+
3
13
  ## v3.15.0 - 2024-10-29
4
14
  ### Changes
5
15
  * :sparkles: add support for image compression
@@ -0,0 +1,169 @@
1
+ ---
2
+ title: Business Card OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-business-card-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
6
+ ---
7
+ The Ruby OCR SDK supports the [Business Card API](https://platform.mindee.com/mindee/business_card).
8
+
9
+ Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/business_card/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK.
10
+ ![Business Card sample](https://github.com/mindee/client-lib-test-data/blob/main/products/business_card/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::BusinessCard::BusinessCardV1
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
+
36
+ **Output (RST):**
37
+ ```rst
38
+ ########
39
+ Document
40
+ ########
41
+ :Mindee ID: 6f9a261f-7609-4687-9af0-46a45156566e
42
+ :Filename: default_sample.jpg
43
+
44
+ Inference
45
+ #########
46
+ :Product: mindee/business_card v1.0
47
+ :Rotation applied: Yes
48
+
49
+ Prediction
50
+ ==========
51
+ :Firstname: Andrew
52
+ :Lastname: Morin
53
+ :Job Title: Founder & CEO
54
+ :Company: RemoteGlobal
55
+ :Email: amorin@remoteglobalconsulting.com
56
+ :Phone Number: +14015555555
57
+ :Mobile Number: +13015555555
58
+ :Fax Number: +14015555556
59
+ :Address: 178 Main Avenue, Providence, RI 02111
60
+ :Website: www.remoteglobalconsulting.com
61
+ :Social Media: https://www.linkedin.com/in/johndoe
62
+ https://twitter.com/johndoe
63
+ ```
64
+
65
+ # Field Types
66
+ ## Standard Fields
67
+ These fields are generic and used in several products.
68
+
69
+ ### Basic Field
70
+ Each prediction object contains a set of fields that inherit from the generic `Field` class.
71
+ A typical `Field` object will have the following attributes:
72
+
73
+ * **value** (`String`, `Float`, `Integer`, `Boolean`): corresponds to the field value. Can be `nil` if no value was extracted.
74
+ * **confidence** (Float, nil): the confidence score of the field prediction.
75
+ * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
76
+ * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
77
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
78
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
79
+
80
+
81
+ 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.
82
+
83
+ ### String Field
84
+ The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
85
+
86
+ # Attributes
87
+ The following fields are extracted for Business Card V1:
88
+
89
+ ## Address
90
+ **address** ([StringField](#string-field)): The address of the person.
91
+
92
+ ```rb
93
+ puts result.document.inference.prediction.address.value
94
+ ```
95
+
96
+ ## Company
97
+ **company** ([StringField](#string-field)): The company the person works for.
98
+
99
+ ```rb
100
+ puts result.document.inference.prediction.company.value
101
+ ```
102
+
103
+ ## Email
104
+ **email** ([StringField](#string-field)): The email address of the person.
105
+
106
+ ```rb
107
+ puts result.document.inference.prediction.email.value
108
+ ```
109
+
110
+ ## Fax Number
111
+ **fax_number** ([StringField](#string-field)): The Fax number of the person.
112
+
113
+ ```rb
114
+ puts result.document.inference.prediction.fax_number.value
115
+ ```
116
+
117
+ ## Firstname
118
+ **firstname** ([StringField](#string-field)): The given name of the person.
119
+
120
+ ```rb
121
+ puts result.document.inference.prediction.firstname.value
122
+ ```
123
+
124
+ ## Job Title
125
+ **job_title** ([StringField](#string-field)): The job title of the person.
126
+
127
+ ```rb
128
+ puts result.document.inference.prediction.job_title.value
129
+ ```
130
+
131
+ ## Lastname
132
+ **lastname** ([StringField](#string-field)): The lastname of the person.
133
+
134
+ ```rb
135
+ puts result.document.inference.prediction.lastname.value
136
+ ```
137
+
138
+ ## Mobile Number
139
+ **mobile_number** ([StringField](#string-field)): The mobile number of the person.
140
+
141
+ ```rb
142
+ puts result.document.inference.prediction.mobile_number.value
143
+ ```
144
+
145
+ ## Phone Number
146
+ **phone_number** ([StringField](#string-field)): The phone number of the person.
147
+
148
+ ```rb
149
+ puts result.document.inference.prediction.phone_number.value
150
+ ```
151
+
152
+ ## Social Media
153
+ **social_media** (Array<[StringField](#string-field)>): The social media profiles of the person or company.
154
+
155
+ ```rb
156
+ for social_media_elem in result.document.inference.prediction.social_media do
157
+ puts social_media_elem.value
158
+ end
159
+ ```
160
+
161
+ ## Website
162
+ **website** ([StringField](#string-field)): The website of the person or company.
163
+
164
+ ```rb
165
+ puts result.document.inference.prediction.website.value
166
+ ```
167
+
168
+ # Questions?
169
+ [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
@@ -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.enqueue_and_parse(
11
+ input_source,
12
+ Mindee::Product::BusinessCard::BusinessCardV1
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
@@ -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.enqueue_and_parse(
11
+ input_source,
12
+ Mindee::Product::DeliveryNote::DeliveryNoteV1
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
@@ -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.enqueue_and_parse(
11
+ input_source,
12
+ Mindee::Product::Receipt::ReceiptV5
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
@@ -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.enqueue_and_parse(
11
+ input_source,
12
+ Mindee::Product::IND::IndianPassport::IndianPassportV1
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
@@ -0,0 +1,143 @@
1
+ ---
2
+ title: Delivery note OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-delivery-note-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
6
+ ---
7
+ The Ruby OCR SDK supports the [Delivery note API](https://platform.mindee.com/mindee/delivery_notes).
8
+
9
+ Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/delivery_notes/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK.
10
+ ![Delivery note sample](https://github.com/mindee/client-lib-test-data/blob/main/products/delivery_notes/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::DeliveryNote::DeliveryNoteV1
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
+
36
+ **Output (RST):**
37
+ ```rst
38
+ ########
39
+ Document
40
+ ########
41
+ :Mindee ID: d5ead821-edec-4d31-a69a-cf3998d9a506
42
+ :Filename: default_sample.jpg
43
+
44
+ Inference
45
+ #########
46
+ :Product: mindee/delivery_notes v1.0
47
+ :Rotation applied: Yes
48
+
49
+ Prediction
50
+ ==========
51
+ :Delivery Date: 2019-10-02
52
+ :Delivery Number: INT-001
53
+ :Supplier Name: John Smith
54
+ :Supplier Address: 4490 Oak Drive, Albany, NY 12210
55
+ :Customer Name: Jessie M Horne
56
+ :Customer Address: 4312 Wood Road, New York, NY 10031
57
+ :Total Amount: 204.75
58
+ ```
59
+
60
+ # Field Types
61
+ ## Standard Fields
62
+ These fields are generic and used in several products.
63
+
64
+ ### Basic Field
65
+ Each prediction object contains a set of fields that inherit from the generic `Field` class.
66
+ A typical `Field` object will have the following attributes:
67
+
68
+ * **value** (`String`, `Float`, `Integer`, `Boolean`): corresponds to the field value. Can be `nil` if no value was extracted.
69
+ * **confidence** (Float, nil): the confidence score of the field prediction.
70
+ * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
71
+ * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
72
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
73
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
74
+
75
+
76
+ 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.
77
+
78
+
79
+ ### Amount Field
80
+ The amount field `AmountField` only has one constraint: its **value** is a `Float` (or `nil`).
81
+
82
+ ### Date Field
83
+ Aside from the basic `Field` attributes, the date field `DateField` also implements the following:
84
+
85
+ * **date_object** (`Date`): an accessible representation of the value as a JavaScript object.
86
+
87
+ ### String Field
88
+ The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
89
+
90
+ # Attributes
91
+ The following fields are extracted for Delivery note V1:
92
+
93
+ ## Customer Address
94
+ **customer_address** ([StringField](#string-field)): The address of the customer receiving the goods.
95
+
96
+ ```rb
97
+ puts result.document.inference.prediction.customer_address.value
98
+ ```
99
+
100
+ ## Customer Name
101
+ **customer_name** ([StringField](#string-field)): The name of the customer receiving the goods.
102
+
103
+ ```rb
104
+ puts result.document.inference.prediction.customer_name.value
105
+ ```
106
+
107
+ ## Delivery Date
108
+ **delivery_date** ([DateField](#date-field)): The date on which the delivery is scheduled to arrive.
109
+
110
+ ```rb
111
+ puts result.document.inference.prediction.delivery_date.value
112
+ ```
113
+
114
+ ## Delivery Number
115
+ **delivery_number** ([StringField](#string-field)): A unique identifier for the delivery note.
116
+
117
+ ```rb
118
+ puts result.document.inference.prediction.delivery_number.value
119
+ ```
120
+
121
+ ## Supplier Address
122
+ **supplier_address** ([StringField](#string-field)): The address of the supplier providing the goods.
123
+
124
+ ```rb
125
+ puts result.document.inference.prediction.supplier_address.value
126
+ ```
127
+
128
+ ## Supplier Name
129
+ **supplier_name** ([StringField](#string-field)): The name of the supplier providing the goods.
130
+
131
+ ```rb
132
+ puts result.document.inference.prediction.supplier_name.value
133
+ ```
134
+
135
+ ## Total Amount
136
+ **total_amount** ([AmountField](#amount-field)): The total monetary value of the goods being delivered.
137
+
138
+ ```rb
139
+ puts result.document.inference.prediction.total_amount.value
140
+ ```
141
+
142
+ # Questions?
143
+ [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
@@ -6,8 +6,8 @@ parentDoc: 6294d97ee723f1008d2ab28e
6
6
  ---
7
7
  The Ruby OCR SDK supports the [Energy Bill API](https://platform.mindee.com/mindee/energy_bill_fra).
8
8
 
9
- Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/energy_bill_fra/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK.
10
- ![Energy Bill sample](https://github.com/mindee/client-lib-test-data/blob/main/products/energy_bill_fra/default_sample.jpg?raw=true)
9
+ Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/energy_bill_fra/default_sample.pdf), we are going to illustrate how to extract the data that we want using the OCR SDK.
10
+ ![Energy Bill sample](https://github.com/mindee/client-lib-test-data/blob/main/products/energy_bill_fra/default_sample.pdf?raw=true)
11
11
 
12
12
  # Quick-Start
13
13
  ```rb
@@ -33,6 +33,31 @@ puts result.document
33
33
 
34
34
  ```
35
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::Receipt::ReceiptV5
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
+ ```
60
+
36
61
  **Output (RST):**
37
62
  ```rst
38
63
  ########
@@ -50,7 +75,7 @@ Prediction
50
75
  ==========
51
76
  :Expense Locale: en-GB; en; GB; GBP;
52
77
  :Purchase Category: food
53
- :Purchase Subcategory:
78
+ :Purchase Subcategory: restaurant
54
79
  :Document Type: EXPENSE RECEIPT
55
80
  :Purchase Date: 2016-02-26
56
81
  :Purchase Time: 15:20
@@ -84,7 +109,7 @@ Page 0
84
109
  ------
85
110
  :Expense Locale: en-GB; en; GB; GBP;
86
111
  :Purchase Category: food
87
- :Purchase Subcategory:
112
+ :Purchase Subcategory: restaurant
88
113
  :Document Type: EXPENSE RECEIPT
89
114
  :Purchase Date: 2016-02-26
90
115
  :Purchase Time: 15:20
@@ -63,23 +63,25 @@ puts result.document
63
63
  ########
64
64
  Document
65
65
  ########
66
- :Mindee ID: 3859a462-e05f-4f4c-a736-febca66b9aa9
66
+ :Mindee ID: b26161ce-35d0-4984-b1ff-886645e160e6
67
67
  :Filename: default_sample.jpg
68
68
 
69
69
  Inference
70
70
  #########
71
- :Product: mindee/financial_document v1.9
71
+ :Product: mindee/financial_document v1.11
72
72
  :Rotation applied: Yes
73
73
 
74
74
  Prediction
75
75
  ==========
76
- :Locale: en; en; USD;
76
+ :Locale: en-US; en; US; USD;
77
77
  :Invoice Number: INT-001
78
+ :Purchase Order Number: 2412/2019
78
79
  :Receipt Number:
79
80
  :Document Number: INT-001
80
81
  :Reference Numbers: 2412/2019
81
82
  :Purchase Date: 2019-11-02
82
83
  :Due Date: 2019-02-26
84
+ :Payment Date: 2019-02-26
83
85
  :Total Net: 195.00
84
86
  :Total Amount: 204.75
85
87
  :Taxes:
@@ -123,13 +125,15 @@ Page Predictions
123
125
 
124
126
  Page 0
125
127
  ------
126
- :Locale: en; en; USD;
128
+ :Locale: en-US; en; US; USD;
127
129
  :Invoice Number: INT-001
130
+ :Purchase Order Number: 2412/2019
128
131
  :Receipt Number:
129
132
  :Document Number: INT-001
130
133
  :Reference Numbers: 2412/2019
131
134
  :Purchase Date: 2019-11-02
132
135
  :Due Date: 2019-02-26
136
+ :Payment Date: 2019-02-26
133
137
  :Total Net: 195.00
134
138
  :Total Amount: 204.75
135
139
  :Taxes: