mindee 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +6 -0
- data/bin/mindee.rb +1 -1
- data/docs/code_samples/expense_receipts_v5.txt +14 -0
- data/docs/ruby-receipt-ocr.md +30 -17
- data/lib/mindee/client.rb +3 -0
- data/lib/mindee/parsing/prediction/common_fields/locale.rb +1 -1
- data/lib/mindee/parsing/prediction/eu/license_plate/license_plate_v1.rb +4 -4
- data/lib/mindee/parsing/prediction/financial_document/financial_document_v1.rb +15 -23
- data/lib/mindee/parsing/prediction/{invoice/invoice_line_item.rb → financial_document/financial_document_v1_line_item.rb} +9 -9
- data/lib/mindee/parsing/prediction/fr/bank_account_details/bank_account_details_v1.rb +6 -6
- data/lib/mindee/parsing/prediction/fr/carte_vitale/carte_vitale_v1.rb +8 -8
- data/lib/mindee/parsing/prediction/fr/id_card/id_card_v1.rb +35 -34
- data/lib/mindee/parsing/prediction/invoice/invoice_v4.rb +14 -18
- data/lib/mindee/parsing/prediction/{financial_document/invoice_line_item.rb → invoice/invoice_v4_line_item.rb} +9 -9
- data/lib/mindee/parsing/prediction/proof_of_address/proof_of_address_v1.rb +36 -36
- data/lib/mindee/parsing/prediction/receipt/receipt_v5.rb +136 -0
- data/lib/mindee/parsing/prediction/receipt/receipt_v5_line_item.rb +37 -0
- data/lib/mindee/parsing/prediction/shipping_container/shipping_container_v1.rb +2 -2
- data/lib/mindee/parsing/prediction.rb +1 -0
- data/lib/mindee/version.rb +1 -1
- data/mindee.gemspec +5 -5
- metadata +17 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 508a1201e41623fdd4b7283a90f09aefbcf66582e610120547b5706017e62c6f
|
4
|
+
data.tar.gz: 552288d7cee7f8b5c38d641a991fb9864f3ebb6f3d7c5140e178ebabec082a84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a697ccd863ee69c721f8fe0199fc6321df1812a6daf9aa51031031d197ae3cd6578b4c09162ebe03cfba0008b26320533a62cd688fbc02c3acaee21488201c8b
|
7
|
+
data.tar.gz: ae97c33e5fd32bc1919b510e4057e0b3355892ca5178fc9e40d3769d55dbb41d3b10ac1b8153f4b028e36ec11d02df977299f0581fe3d3cbf8412be23f2bec33
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Mindee Ruby API Library Changelog
|
2
2
|
|
3
|
+
## v2.2.0 - 2023-05-16
|
4
|
+
### Changes
|
5
|
+
* :sparkles: add support for Receipts v5
|
6
|
+
* :pushpin: more specific dependency pinning; update some dependencies
|
7
|
+
|
8
|
+
|
3
9
|
## v2.1.1 - 2023-04-21
|
4
10
|
### Changes
|
5
11
|
* :memo: minor docstring improvements
|
data/bin/mindee.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'mindee'
|
2
|
+
|
3
|
+
# Init a new client, specifying an API key
|
4
|
+
mindee_client = Mindee::Client.new(api_key: 'my-api-key')
|
5
|
+
|
6
|
+
# Load a file from disk and parse it
|
7
|
+
result = mindee_client.doc_from_path('/path/to/the/file.ext')
|
8
|
+
.parse(Mindee::Prediction::ReceiptV5)
|
9
|
+
|
10
|
+
# Print a full summary of the parsed data in RST format
|
11
|
+
puts result
|
12
|
+
|
13
|
+
# Print the document-level parsed data
|
14
|
+
# puts result.inference.prediction
|
data/docs/ruby-receipt-ocr.md
CHANGED
@@ -2,7 +2,7 @@ The Ruby OCR SDK supports the [receipt API](https://developers.mindee.com/docs/
|
|
2
2
|
|
3
3
|
Using this sample below, we are going to illustrate how to extract the data that we want using the OCR SDK.
|
4
4
|
|
5
|
-
![sample receipt](https://raw.githubusercontent.com/mindee/client-lib-test-data/main/receipt/receipt
|
5
|
+
![sample receipt](https://raw.githubusercontent.com/mindee/client-lib-test-data/main/receipt/receipt.jpg)
|
6
6
|
|
7
7
|
## Quick Start
|
8
8
|
```ruby
|
@@ -11,27 +11,41 @@ require 'mindee'
|
|
11
11
|
# Init a new client, specifying an API key
|
12
12
|
mindee_client = Mindee::Client.new(api_key: 'my-api-key')
|
13
13
|
|
14
|
-
#
|
15
|
-
result = mindee_client.doc_from_path('/path/to/the/file.ext')
|
14
|
+
# Load a file from disk and parse it
|
15
|
+
result = mindee_client.doc_from_path('/path/to/the/file.ext')
|
16
|
+
.parse(Mindee::Prediction::ReceiptV5)
|
16
17
|
|
17
|
-
# Print a summary of the
|
18
|
+
# Print a full summary of the parsed data in RST format
|
19
|
+
# puts result
|
20
|
+
|
21
|
+
# Print the document-level parsed data
|
18
22
|
puts result.inference.prediction
|
19
23
|
```
|
20
24
|
|
21
25
|
Output:
|
22
26
|
```
|
23
|
-
:Locale: en-
|
24
|
-
:
|
25
|
-
:Category:
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:Time:
|
29
|
-
:
|
30
|
-
:Taxes:
|
31
|
-
:Total
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
27
|
+
:Expense Locale: en-GB; en; GB; GBP;
|
28
|
+
:Expense Category: food
|
29
|
+
:Expense Sub Category: restaurant
|
30
|
+
:Document Type: EXPENSE RECEIPT
|
31
|
+
:Purchase Date: 2016-02-26
|
32
|
+
:Purchase Time: 15:20
|
33
|
+
:Total Amount: 10.20
|
34
|
+
:Total Excluding Taxes: 8.50
|
35
|
+
:Total Tax: 1.70
|
36
|
+
:Tip and Gratuity:
|
37
|
+
:Taxes: 1.70 20.00% VAT
|
38
|
+
:Supplier Name: CLACHAN
|
39
|
+
:Supplier Company Registrations: 232153895
|
40
|
+
232153895
|
41
|
+
:Supplier Address: 34 kingley street w1b 5qh
|
42
|
+
:Supplier Phone Number: 02074940834
|
43
|
+
:Line Items:
|
44
|
+
+--------------------------------------+----------+--------------+------------+
|
45
|
+
| Description | Quantity | Total Amount | Unit Price |
|
46
|
+
+======================================+==========+==============+============+
|
47
|
+
| Meantime Pale | 2.00 | 10.20 | |
|
48
|
+
+--------------------------------------+----------+--------------+------------+
|
35
49
|
```
|
36
50
|
|
37
51
|
## Fields
|
@@ -50,7 +64,6 @@ Depending on the field type specified, additional attributes can be extracted in
|
|
50
64
|
|
51
65
|
Using the above sample, the following are the basic fields that can be extracted:
|
52
66
|
|
53
|
-
- [Orientation](#orientation)
|
54
67
|
- [Category](#category)
|
55
68
|
- [Date](#date)
|
56
69
|
- [Locale](#locale)
|
data/lib/mindee/client.rb
CHANGED
@@ -183,6 +183,9 @@ module Mindee
|
|
183
183
|
@doc_configs[['mindee', Prediction::ReceiptV4.name]] = standard_document_config(
|
184
184
|
Prediction::ReceiptV4, 'expense_receipts', '4'
|
185
185
|
)
|
186
|
+
@doc_configs[['mindee', Prediction::ReceiptV5.name]] = standard_document_config(
|
187
|
+
Prediction::ReceiptV5, 'expense_receipts', '5'
|
188
|
+
)
|
186
189
|
@doc_configs[['mindee', Prediction::PassportV1.name]] = standard_document_config(
|
187
190
|
Prediction::PassportV1, 'passport', '1'
|
188
191
|
)
|
@@ -6,9 +6,9 @@ require_relative '../../base'
|
|
6
6
|
module Mindee
|
7
7
|
module Prediction
|
8
8
|
module EU
|
9
|
-
# License
|
9
|
+
# License Plate v1 prediction results.
|
10
10
|
class LicensePlateV1 < Prediction
|
11
|
-
#
|
11
|
+
# List of all license plates found in the image.
|
12
12
|
# @return [Array<Mindee::TextField>]
|
13
13
|
attr_reader :license_plates
|
14
14
|
|
@@ -23,9 +23,9 @@ module Mindee
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def to_s
|
26
|
-
license_plates = @license_plates.
|
26
|
+
license_plates = @license_plates.join("\n #{' ' * 16}")
|
27
27
|
out_str = String.new
|
28
|
-
out_str << "\n:License
|
28
|
+
out_str << "\n:License Plates: #{license_plates}".rstrip
|
29
29
|
out_str[1..].to_s
|
30
30
|
end
|
31
31
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require_relative '../common_fields'
|
4
4
|
require_relative '../base'
|
5
|
-
require_relative '
|
5
|
+
require_relative 'financial_document_v1_line_item'
|
6
6
|
|
7
7
|
module Mindee
|
8
8
|
module Prediction
|
@@ -60,7 +60,7 @@ module Mindee
|
|
60
60
|
# @return [Array<Mindee::CompanyRegistration>]
|
61
61
|
attr_reader :supplier_company_registrations
|
62
62
|
# Line items details.
|
63
|
-
# @return [Array<Mindee::
|
63
|
+
# @return [Array<Mindee::FinancialDocumentV1LineItem>]
|
64
64
|
attr_reader :line_items
|
65
65
|
# Time as seen on the receipt in HH:MM format.
|
66
66
|
# @return [Mindee::TextField]
|
@@ -83,7 +83,6 @@ module Mindee
|
|
83
83
|
# @param page_id [Integer, nil]
|
84
84
|
def initialize(prediction, page_id) # rubocop:todo Metrics/AbcSize
|
85
85
|
super
|
86
|
-
|
87
86
|
@time = TextField.new(prediction['time'], page_id)
|
88
87
|
@category = TextField.new(prediction['category'], page_id)
|
89
88
|
@subcategory = TextField.new(prediction['subcategory'], page_id)
|
@@ -100,7 +99,6 @@ module Mindee
|
|
100
99
|
@invoice_number = TextField.new(prediction['invoice_number'], page_id)
|
101
100
|
@supplier_name = TextField.new(prediction['supplier_name'], page_id)
|
102
101
|
@supplier_address = TextField.new(prediction['supplier_address'], page_id)
|
103
|
-
|
104
102
|
@reference_numbers = []
|
105
103
|
prediction['reference_numbers'].each do |item|
|
106
104
|
@reference_numbers.push(TextField.new(item, page_id))
|
@@ -121,14 +119,12 @@ module Mindee
|
|
121
119
|
prediction['supplier_company_registrations'].each do |item|
|
122
120
|
@supplier_company_registrations.push(CompanyRegistration.new(item, page_id))
|
123
121
|
end
|
124
|
-
|
125
122
|
@total_tax = AmountField.new(
|
126
123
|
{ value: nil, confidence: 0.0 }, page_id
|
127
124
|
)
|
128
|
-
|
129
125
|
@line_items = []
|
130
126
|
prediction['line_items'].each do |item|
|
131
|
-
@line_items.push(
|
127
|
+
@line_items.push(FinancialDocumentV1LineItem.new(item, page_id))
|
132
128
|
end
|
133
129
|
reconstruct(page_id)
|
134
130
|
end
|
@@ -153,39 +149,35 @@ module Mindee
|
|
153
149
|
out_str << "\n:Supplier address: #{@supplier_address}".rstrip
|
154
150
|
out_str << "\n:Supplier company registrations: #{supplier_company_registrations}".rstrip
|
155
151
|
out_str << "\n:Supplier payment details: #{supplier_payment_details}".rstrip
|
156
|
-
|
157
152
|
out_str << "\n:Customer name: #{@customer_name}".rstrip
|
158
153
|
out_str << "\n:Customer address: #{@customer_address}".rstrip
|
159
154
|
out_str << "\n:Customer company registrations: #{customer_company_registrations}".rstrip
|
160
|
-
|
161
155
|
out_str << "\n:Tip: #{@tip}".rstrip
|
162
|
-
|
163
156
|
out_str << "\n:Taxes: #{taxes}".rstrip
|
164
157
|
out_str << "\n:Total taxes: #{@total_tax}".rstrip
|
165
158
|
out_str << "\n:Total net: #{@total_net}".rstrip
|
166
159
|
out_str << "\n:Total amount: #{@total_amount}".rstrip
|
167
|
-
|
160
|
+
out_str << "\n:Line Items:"
|
168
161
|
out_str << line_items_to_s
|
169
|
-
|
170
162
|
out_str[1..].to_s
|
171
163
|
end
|
172
164
|
|
173
165
|
private
|
174
166
|
|
167
|
+
def line_item_separator(char)
|
168
|
+
" +#{char * 22}+#{char * 9}+#{char * 9}+#{char * 10}+#{char * 18}+#{char * 38}+"
|
169
|
+
end
|
170
|
+
|
175
171
|
def line_items_to_s
|
176
|
-
|
177
|
-
line_items = @line_items.map(&:to_s).join("\n")
|
172
|
+
return '' if @line_items.empty?
|
178
173
|
|
174
|
+
line_items = @line_items.map(&:to_s).join("\n#{line_item_separator('-')}\n ")
|
179
175
|
out_str = String.new
|
180
|
-
out_str << "\n
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
out_str << "\n#{line_item_separator}"
|
185
|
-
out_str << "\nCode QTY Price Amount Tax (Rate) Description"
|
186
|
-
out_str << "\n#{line_item_separator}"
|
187
|
-
out_str << "\n#{line_items}"
|
188
|
-
out_str << "\n#{line_item_separator}"
|
176
|
+
out_str << "\n#{line_item_separator('-')}"
|
177
|
+
out_str << "\n | Code#{' ' * 17}| QTY | Price | Amount | Tax (Rate) | Description#{' ' * 26}|"
|
178
|
+
out_str << "\n#{line_item_separator('=')}"
|
179
|
+
out_str << "\n #{line_items}"
|
180
|
+
out_str << "\n#{line_item_separator('-')}"
|
189
181
|
end
|
190
182
|
|
191
183
|
def reconstruct(page_id)
|
@@ -4,7 +4,7 @@ require_relative '../common_fields/base'
|
|
4
4
|
|
5
5
|
module Mindee
|
6
6
|
# Line items for invoices
|
7
|
-
class
|
7
|
+
class FinancialDocumentV1LineItem
|
8
8
|
# @return [String] The product code referring to the item.
|
9
9
|
attr_reader :product_code
|
10
10
|
# @return [String]
|
@@ -39,20 +39,20 @@ module Mindee
|
|
39
39
|
@page_id = page_id
|
40
40
|
end
|
41
41
|
|
42
|
+
# @return String
|
42
43
|
def to_s
|
43
44
|
tax = Field.float_to_string(@tax_amount)
|
44
45
|
tax << " (#{Field.float_to_string(@tax_rate)}%)" unless @tax_rate.nil?
|
45
|
-
|
46
46
|
description = @description.nil? ? '' : @description
|
47
47
|
description = "#{description[0..32]}..." if description.size > 35
|
48
|
-
|
49
48
|
out_str = String.new
|
50
|
-
out_str << format('%-
|
51
|
-
out_str << " #{format('%-
|
52
|
-
out_str << " #{format('%-
|
53
|
-
out_str << " #{format('%-
|
54
|
-
out_str << " #{format('%-
|
55
|
-
out_str << " #{description}"
|
49
|
+
out_str << format('| %- 20s', @product_code)
|
50
|
+
out_str << " #{format('| %- 7s', Field.float_to_string(@quantity))}"
|
51
|
+
out_str << " #{format('| %- 7s', Field.float_to_string(@unit_price))}"
|
52
|
+
out_str << " #{format('| %- 8s', Field.float_to_string(@total_amount))}"
|
53
|
+
out_str << " #{format('| %- 16s', tax)}"
|
54
|
+
out_str << " #{format('| %- 37s', description)}"
|
55
|
+
out_str << '|'
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -6,15 +6,15 @@ require_relative '../../base'
|
|
6
6
|
module Mindee
|
7
7
|
module Prediction
|
8
8
|
module FR
|
9
|
-
#
|
9
|
+
# Bank Account Details v1 prediction results.
|
10
10
|
class BankAccountDetailsV1 < Prediction
|
11
|
-
# The
|
11
|
+
# The International Bank Account Number (IBAN).
|
12
12
|
# @return [Mindee::TextField]
|
13
13
|
attr_reader :iban
|
14
|
-
# The account holder
|
14
|
+
# The name of the account holder as seen on the document.
|
15
15
|
# @return [Mindee::TextField]
|
16
16
|
attr_reader :account_holder_name
|
17
|
-
# The bank's SWIFT
|
17
|
+
# The bank's SWIFT Business Identifier Code (BIC).
|
18
18
|
# @return [Mindee::TextField]
|
19
19
|
attr_reader :swift
|
20
20
|
|
@@ -30,8 +30,8 @@ module Mindee
|
|
30
30
|
def to_s
|
31
31
|
out_str = String.new
|
32
32
|
out_str << "\n:IBAN: #{@iban}".rstrip
|
33
|
-
out_str << "\n:Account
|
34
|
-
out_str << "\n:SWIFT: #{@swift}".rstrip
|
33
|
+
out_str << "\n:Account Holder's Name: #{@account_holder_name}".rstrip
|
34
|
+
out_str << "\n:SWIFT Code: #{@swift}".rstrip
|
35
35
|
out_str[1..].to_s
|
36
36
|
end
|
37
37
|
end
|
@@ -6,18 +6,18 @@ require_relative '../../base'
|
|
6
6
|
module Mindee
|
7
7
|
module Prediction
|
8
8
|
module FR
|
9
|
-
#
|
9
|
+
# Carte Vitale v1 prediction results.
|
10
10
|
class CarteVitaleV1 < Prediction
|
11
|
-
#
|
11
|
+
# The given name(s) of the card holder.
|
12
12
|
# @return [Array<Mindee::TextField>]
|
13
13
|
attr_reader :given_names
|
14
|
-
# The surname
|
14
|
+
# The surname of the card holder.
|
15
15
|
# @return [Mindee::TextField]
|
16
16
|
attr_reader :surname
|
17
|
-
# The
|
17
|
+
# The Social Security Number (Numéro de Sécurité Sociale) of the card holder
|
18
18
|
# @return [Mindee::TextField]
|
19
19
|
attr_reader :social_security
|
20
|
-
# The
|
20
|
+
# The date the card was issued.
|
21
21
|
# @return [Mindee::DateField]
|
22
22
|
attr_reader :issuance_date
|
23
23
|
|
@@ -35,12 +35,12 @@ module Mindee
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def to_s
|
38
|
-
given_names = @given_names.
|
38
|
+
given_names = @given_names.join("\n #{' ' * 15}")
|
39
39
|
out_str = String.new
|
40
|
-
out_str << "\n:Given
|
40
|
+
out_str << "\n:Given Name(s): #{given_names}".rstrip
|
41
41
|
out_str << "\n:Surname: #{@surname}".rstrip
|
42
42
|
out_str << "\n:Social Security Number: #{@social_security}".rstrip
|
43
|
-
out_str << "\n:Issuance
|
43
|
+
out_str << "\n:Issuance Date: #{@issuance_date}".rstrip
|
44
44
|
out_str[1..].to_s
|
45
45
|
end
|
46
46
|
end
|
@@ -6,39 +6,39 @@ require_relative '../../base'
|
|
6
6
|
module Mindee
|
7
7
|
module Prediction
|
8
8
|
module FR
|
9
|
-
#
|
9
|
+
# Carte Nationale d'Identité v1 prediction results.
|
10
10
|
class IdCardV1 < Prediction
|
11
|
-
# The
|
12
|
-
# @return [Array<Mindee::TextField>]
|
13
|
-
attr_reader :authority
|
14
|
-
# Indicates if it is the recto side, the verso side or both.
|
11
|
+
# The side of the document which is visible.
|
15
12
|
# @return [Mindee::TextField]
|
16
13
|
attr_reader :document_side
|
17
|
-
# The card number.
|
14
|
+
# The identification card number.
|
18
15
|
# @return [Mindee::TextField]
|
19
16
|
attr_reader :id_number
|
20
|
-
# The
|
21
|
-
# @return [Mindee::
|
22
|
-
attr_reader :
|
23
|
-
# The surname
|
17
|
+
# The given name(s) of the card holder.
|
18
|
+
# @return [Array<Mindee::TextField>]
|
19
|
+
attr_reader :given_names
|
20
|
+
# The surname of the card holder.
|
24
21
|
# @return [Mindee::TextField]
|
25
22
|
attr_reader :surname
|
26
|
-
#
|
27
|
-
# @return [Mindee::TextField]
|
28
|
-
attr_reader :given_names
|
29
|
-
# The date of birth of the cardholder.
|
23
|
+
# The date of birth of the card holder.
|
30
24
|
# @return [Mindee::DateField]
|
31
25
|
attr_reader :birth_date
|
32
|
-
# The place of birth of the
|
26
|
+
# The place of birth of the card holder.
|
33
27
|
# @return [Mindee::TextField]
|
34
28
|
attr_reader :birth_place
|
35
|
-
# The
|
29
|
+
# The expiry date of the identification card.
|
30
|
+
# @return [Mindee::DateField]
|
31
|
+
attr_reader :expiry_date
|
32
|
+
# The name of the issuing authority.
|
33
|
+
# @return [Mindee::TextField]
|
34
|
+
attr_reader :authority
|
35
|
+
# The gender of the card holder.
|
36
36
|
# @return [Mindee::TextField]
|
37
37
|
attr_reader :gender
|
38
|
-
#
|
38
|
+
# Machine Readable Zone, first line
|
39
39
|
# @return [Mindee::TextField]
|
40
40
|
attr_reader :mrz1
|
41
|
-
#
|
41
|
+
# Machine Readable Zone, second line
|
42
42
|
# @return [Mindee::TextField]
|
43
43
|
attr_reader :mrz2
|
44
44
|
|
@@ -49,33 +49,34 @@ module Mindee
|
|
49
49
|
@document_side = TextField.new(prediction['document_side'], page_id) if page_id
|
50
50
|
@authority = TextField.new(prediction['authority'], page_id)
|
51
51
|
@id_number = TextField.new(prediction['id_number'], page_id)
|
52
|
+
@given_names = []
|
53
|
+
prediction['given_names'].each do |item|
|
54
|
+
@given_names.push(TextField.new(item, page_id))
|
55
|
+
end
|
56
|
+
@surname = TextField.new(prediction['surname'], page_id)
|
52
57
|
@birth_date = DateField.new(prediction['birth_date'], page_id)
|
53
|
-
@expiry_date = DateField.new(prediction['expiry_date'], page_id)
|
54
58
|
@birth_place = TextField.new(prediction['birth_place'], page_id)
|
59
|
+
@expiry_date = DateField.new(prediction['expiry_date'], page_id)
|
60
|
+
@authority = TextField.new(prediction['authority'], page_id)
|
55
61
|
@gender = TextField.new(prediction['gender'], page_id)
|
56
|
-
@surname = TextField.new(prediction['surname'], page_id)
|
57
62
|
@mrz1 = TextField.new(prediction['mrz1'], page_id)
|
58
63
|
@mrz2 = TextField.new(prediction['mrz2'], page_id)
|
59
|
-
@given_names = []
|
60
|
-
prediction['given_names'].each do |item|
|
61
|
-
@given_names.push(TextField.new(item, page_id))
|
62
|
-
end
|
63
64
|
end
|
64
65
|
|
65
66
|
def to_s
|
66
|
-
given_names = @given_names.
|
67
|
+
given_names = @given_names.join("\n #{' ' * 15}")
|
67
68
|
out_str = String.new
|
68
|
-
out_str << "\n:Document
|
69
|
-
out_str << "\n:
|
70
|
-
out_str << "\n:Given
|
69
|
+
out_str << "\n:Document Side: #{@document_side}".rstrip if @document_side
|
70
|
+
out_str << "\n:Identity Number: #{@id_number}".rstrip
|
71
|
+
out_str << "\n:Given Name(s): #{given_names}".rstrip
|
71
72
|
out_str << "\n:Surname: #{@surname}".rstrip
|
73
|
+
out_str << "\n:Date of Birth: #{@birth_date}".rstrip
|
74
|
+
out_str << "\n:Place of Birth: #{@birth_place}".rstrip
|
75
|
+
out_str << "\n:Expiry Date: #{@expiry_date}".rstrip
|
76
|
+
out_str << "\n:Issuing Authority: #{@authority}".rstrip
|
72
77
|
out_str << "\n:Gender: #{@gender}".rstrip
|
73
|
-
out_str << "\n:
|
74
|
-
out_str << "\n:
|
75
|
-
out_str << "\n:Birth place: #{@birth_place}".rstrip
|
76
|
-
out_str << "\n:Expiry date: #{@expiry_date}".rstrip
|
77
|
-
out_str << "\n:MRZ 1: #{@mrz1}".rstrip
|
78
|
-
out_str << "\n:MRZ 2: #{@mrz2}".rstrip
|
78
|
+
out_str << "\n:MRZ Line 1: #{@mrz1}".rstrip
|
79
|
+
out_str << "\n:MRZ Line 2: #{@mrz2}".rstrip
|
79
80
|
out_str[1..].to_s
|
80
81
|
end
|
81
82
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative '../common_fields'
|
4
|
-
require_relative 'invoice_line_item'
|
5
4
|
require_relative '../base'
|
5
|
+
require_relative 'invoice_v4_line_item'
|
6
6
|
|
7
7
|
module Mindee
|
8
8
|
module Prediction
|
@@ -60,7 +60,7 @@ module Mindee
|
|
60
60
|
# @return [Array<Mindee::CompanyRegistration>]
|
61
61
|
attr_reader :supplier_company_registrations
|
62
62
|
# Line items details.
|
63
|
-
# @return [Array<Mindee::
|
63
|
+
# @return [Array<Mindee::InvoiceV4LineItem>]
|
64
64
|
attr_reader :line_items
|
65
65
|
|
66
66
|
# @param prediction [Hash]
|
@@ -78,7 +78,6 @@ module Mindee
|
|
78
78
|
@invoice_number = TextField.new(prediction['invoice_number'], page_id)
|
79
79
|
@supplier_name = TextField.new(prediction['supplier_name'], page_id)
|
80
80
|
@supplier_address = TextField.new(prediction['supplier_address'], page_id)
|
81
|
-
|
82
81
|
@reference_numbers = []
|
83
82
|
prediction['reference_numbers'].each do |item|
|
84
83
|
@reference_numbers.push(TextField.new(item, page_id))
|
@@ -99,14 +98,12 @@ module Mindee
|
|
99
98
|
prediction['supplier_company_registrations'].each do |item|
|
100
99
|
@supplier_company_registrations.push(CompanyRegistration.new(item, page_id))
|
101
100
|
end
|
102
|
-
|
103
101
|
@total_tax = AmountField.new(
|
104
102
|
{ value: nil, confidence: 0.0 }, page_id
|
105
103
|
)
|
106
|
-
|
107
104
|
@line_items = []
|
108
105
|
prediction['line_items'].each do |item|
|
109
|
-
@line_items.push(
|
106
|
+
@line_items.push(InvoiceV4LineItem.new(item, page_id))
|
110
107
|
end
|
111
108
|
reconstruct(page_id)
|
112
109
|
end
|
@@ -124,39 +121,38 @@ module Mindee
|
|
124
121
|
out_str << "\n:Reference numbers: #{reference_numbers}".rstrip
|
125
122
|
out_str << "\n:Invoice date: #{@date}".rstrip
|
126
123
|
out_str << "\n:Invoice due date: #{@due_date}".rstrip
|
127
|
-
|
128
124
|
out_str << "\n:Supplier name: #{@supplier_name}".rstrip
|
129
125
|
out_str << "\n:Supplier address: #{@supplier_address}".rstrip
|
130
126
|
out_str << "\n:Supplier company registrations: #{supplier_company_registrations}".rstrip
|
131
127
|
out_str << "\n:Supplier payment details: #{supplier_payment_details}".rstrip
|
132
|
-
|
133
128
|
out_str << "\n:Customer name: #{@customer_name}".rstrip
|
134
129
|
out_str << "\n:Customer address: #{@customer_address}".rstrip
|
135
130
|
out_str << "\n:Customer company registrations: #{customer_company_registrations}".rstrip
|
136
|
-
|
137
131
|
out_str << "\n:Taxes: #{taxes}".rstrip
|
138
132
|
out_str << "\n:Total net: #{@total_net}".rstrip
|
139
133
|
out_str << "\n:Total taxes: #{@total_tax}".rstrip
|
140
134
|
out_str << "\n:Total amount: #{@total_amount}".rstrip
|
135
|
+
out_str << "\n:Line Items:"
|
141
136
|
out_str << line_items_to_s
|
142
|
-
|
143
137
|
out_str[1..].to_s
|
144
138
|
end
|
145
139
|
|
146
140
|
private
|
147
141
|
|
142
|
+
def line_item_separator(char)
|
143
|
+
" +#{char * 22}+#{char * 9}+#{char * 9}+#{char * 10}+#{char * 18}+#{char * 38}+"
|
144
|
+
end
|
145
|
+
|
148
146
|
def line_items_to_s
|
149
147
|
return '' if @line_items.empty?
|
150
148
|
|
151
|
-
|
152
|
-
line_items = @line_items.map(&:to_s).join("\n")
|
149
|
+
line_items = @line_items.map(&:to_s).join("\n#{line_item_separator('-')}\n ")
|
153
150
|
out_str = String.new
|
154
|
-
out_str << "\n
|
155
|
-
out_str << "\n#{
|
156
|
-
out_str << "\
|
157
|
-
out_str << "\n#{
|
158
|
-
out_str << "\n#{
|
159
|
-
out_str << "\n#{line_item_separator}" unless line_items.empty?
|
151
|
+
out_str << "\n#{line_item_separator('-')}"
|
152
|
+
out_str << "\n | Code#{' ' * 17}| QTY | Price | Amount | Tax (Rate) | Description #{' ' * 25}|"
|
153
|
+
out_str << "\n#{line_item_separator('=')}"
|
154
|
+
out_str << "\n #{line_items}"
|
155
|
+
out_str << "\n#{line_item_separator('-')}"
|
160
156
|
end
|
161
157
|
|
162
158
|
def reconstruct(page_id)
|
@@ -4,7 +4,7 @@ require_relative '../common_fields/base'
|
|
4
4
|
|
5
5
|
module Mindee
|
6
6
|
# Line items for invoices
|
7
|
-
class
|
7
|
+
class InvoiceV4LineItem
|
8
8
|
# @return [String] The product code referring to the item.
|
9
9
|
attr_reader :product_code
|
10
10
|
# @return [String]
|
@@ -39,20 +39,20 @@ module Mindee
|
|
39
39
|
@page_id = page_id
|
40
40
|
end
|
41
41
|
|
42
|
+
# @return String
|
42
43
|
def to_s
|
43
44
|
tax = Field.float_to_string(@tax_amount)
|
44
45
|
tax << " (#{Field.float_to_string(@tax_rate)}%)" unless @tax_rate.nil?
|
45
|
-
|
46
46
|
description = @description.nil? ? '' : @description
|
47
47
|
description = "#{description[0..32]}..." if description.size > 35
|
48
|
-
|
49
48
|
out_str = String.new
|
50
|
-
out_str << format('%-
|
51
|
-
out_str << " #{format('%-
|
52
|
-
out_str << " #{format('%-
|
53
|
-
out_str << " #{format('%-
|
54
|
-
out_str << " #{format('%-
|
55
|
-
out_str << " #{description}"
|
49
|
+
out_str << format('| %- 20s', @product_code)
|
50
|
+
out_str << " #{format('| %- 7s', Field.float_to_string(@quantity))}"
|
51
|
+
out_str << " #{format('| %- 7s', Field.float_to_string(@unit_price))}"
|
52
|
+
out_str << " #{format('| %- 8s', Field.float_to_string(@total_amount))}"
|
53
|
+
out_str << " #{format('| %- 16s', tax)}"
|
54
|
+
out_str << " #{format('| %- 37s', description)}"
|
55
|
+
out_str << '|'
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -5,74 +5,74 @@ require_relative '../base'
|
|
5
5
|
|
6
6
|
module Mindee
|
7
7
|
module Prediction
|
8
|
-
#
|
8
|
+
# Proof of Address v1 prediction results.
|
9
9
|
class ProofOfAddressV1 < Prediction
|
10
|
-
#
|
10
|
+
# The locale detected on the document.
|
11
11
|
# @return [Mindee::Locale]
|
12
12
|
attr_reader :locale
|
13
|
-
#
|
14
|
-
# @return [Mindee::DateField]
|
15
|
-
attr_reader :date
|
16
|
-
# All extracted ISO date yyyy-mm-dd. Works both for European and US dates.
|
17
|
-
# @return [Array<Mindee::DateField>]
|
18
|
-
attr_reader :dates
|
19
|
-
# Address of the document's issuer.
|
13
|
+
# The name of the person or company issuing the document.
|
20
14
|
# @return [Mindee::TextField]
|
21
|
-
attr_reader :
|
22
|
-
#
|
23
|
-
# @return [Array<Mindee::
|
15
|
+
attr_reader :issuer_name
|
16
|
+
# List of company registrations found for the issuer.
|
17
|
+
# @return [Array<Mindee::CompanyRegistrationField>]
|
24
18
|
attr_reader :issuer_company_registration
|
25
|
-
#
|
19
|
+
# The address of the document's issuer.
|
26
20
|
# @return [Mindee::TextField]
|
27
|
-
attr_reader :
|
28
|
-
#
|
21
|
+
attr_reader :issuer_address
|
22
|
+
# The name of the person or company receiving the document.
|
29
23
|
# @return [Mindee::TextField]
|
30
|
-
attr_reader :
|
31
|
-
#
|
32
|
-
# @return [Array<Mindee::
|
24
|
+
attr_reader :recipient_name
|
25
|
+
# List of company registrations found for the recipient.
|
26
|
+
# @return [Array<Mindee::CompanyRegistrationField>]
|
33
27
|
attr_reader :recipient_company_registration
|
34
|
-
#
|
28
|
+
# The address of the recipient.
|
35
29
|
# @return [Mindee::TextField]
|
36
|
-
attr_reader :
|
30
|
+
attr_reader :recipient_address
|
31
|
+
# List of dates found on the document.
|
32
|
+
# @return [Array<Mindee::DateField>]
|
33
|
+
attr_reader :dates
|
34
|
+
# The date the document was issued.
|
35
|
+
# @return [Mindee::DateField]
|
36
|
+
attr_reader :date
|
37
37
|
|
38
38
|
# @param prediction [Hash]
|
39
39
|
# @param page_id [Integer, nil]
|
40
40
|
def initialize(prediction, page_id)
|
41
41
|
super
|
42
|
-
@locale = Locale.new(prediction['locale'])
|
43
|
-
@date = DateField.new(prediction['date'], page_id)
|
44
|
-
@dates = []
|
45
|
-
prediction['dates'].each do |item|
|
46
|
-
@dates.push(DateField.new(item, page_id))
|
47
|
-
end
|
42
|
+
@locale = Locale.new(prediction['locale'], page_id)
|
48
43
|
@issuer_name = TextField.new(prediction['issuer_name'], page_id)
|
49
|
-
@issuer_address = TextField.new(prediction['issuer_address'], page_id)
|
50
44
|
@issuer_company_registration = []
|
51
45
|
prediction['issuer_company_registration'].each do |item|
|
52
46
|
@issuer_company_registration.push(CompanyRegistration.new(item, page_id))
|
53
47
|
end
|
48
|
+
@issuer_address = TextField.new(prediction['issuer_address'], page_id)
|
54
49
|
@recipient_name = TextField.new(prediction['recipient_name'], page_id)
|
55
|
-
@recipient_address = TextField.new(prediction['recipient_address'], page_id)
|
56
50
|
@recipient_company_registration = []
|
57
51
|
prediction['recipient_company_registration'].each do |item|
|
58
52
|
@recipient_company_registration.push(CompanyRegistration.new(item, page_id))
|
59
53
|
end
|
54
|
+
@recipient_address = TextField.new(prediction['recipient_address'], page_id)
|
55
|
+
@dates = []
|
56
|
+
prediction['dates'].each do |item|
|
57
|
+
@dates.push(DateField.new(item, page_id))
|
58
|
+
end
|
59
|
+
@date = DateField.new(prediction['date'], page_id)
|
60
60
|
end
|
61
61
|
|
62
62
|
def to_s
|
63
|
-
|
64
|
-
|
65
|
-
dates = @dates.join("\n
|
63
|
+
issuer_company_registration = @issuer_company_registration.join("\n #{' ' * 30}")
|
64
|
+
recipient_company_registration = @recipient_company_registration.join("\n #{' ' * 33}")
|
65
|
+
dates = @dates.join("\n #{' ' * 7}")
|
66
66
|
out_str = String.new
|
67
67
|
out_str << "\n:Locale: #{@locale}".rstrip
|
68
|
-
out_str << "\n:Issuer
|
68
|
+
out_str << "\n:Issuer Name: #{@issuer_name}".rstrip
|
69
|
+
out_str << "\n:Issuer Company Registrations: #{issuer_company_registration}".rstrip
|
69
70
|
out_str << "\n:Issuer Address: #{@issuer_address}".rstrip
|
70
|
-
out_str << "\n:
|
71
|
-
out_str << "\n:Recipient
|
71
|
+
out_str << "\n:Recipient Name: #{@recipient_name}".rstrip
|
72
|
+
out_str << "\n:Recipient Company Registrations: #{recipient_company_registration}".rstrip
|
72
73
|
out_str << "\n:Recipient Address: #{@recipient_address}".rstrip
|
73
|
-
out_str << "\n:Recipient Company Registrations: #{recipient_company_registrations}".rstrip
|
74
|
-
out_str << "\n:Issuance date: #{@date}".rstrip
|
75
74
|
out_str << "\n:Dates: #{dates}".rstrip
|
75
|
+
out_str << "\n:Date of Issue: #{@date}".rstrip
|
76
76
|
out_str[1..].to_s
|
77
77
|
end
|
78
78
|
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../common_fields'
|
4
|
+
require_relative '../base'
|
5
|
+
require_relative 'receipt_v5_line_item'
|
6
|
+
|
7
|
+
module Mindee
|
8
|
+
module Prediction
|
9
|
+
# Expense Receipt v5 prediction results.
|
10
|
+
class ReceiptV5 < Prediction
|
11
|
+
# The locale identifier in BCP 47 (RFC 5646) format: ISO language code, '-', ISO country code.
|
12
|
+
# @return [Mindee::Locale]
|
13
|
+
attr_reader :locale
|
14
|
+
# The receipt category among predefined classes.
|
15
|
+
# @return [Mindee::TextField]
|
16
|
+
attr_reader :category
|
17
|
+
# The receipt sub category among predefined classes for transport and food.
|
18
|
+
# @return [Mindee::TextField]
|
19
|
+
attr_reader :subcategory
|
20
|
+
# Whether the document is an expense receipt or a credit card receipt.
|
21
|
+
# @return [Mindee::TextField]
|
22
|
+
attr_reader :document_type
|
23
|
+
# The date the purchase was made.
|
24
|
+
# @return [Mindee::DateField]
|
25
|
+
attr_reader :date
|
26
|
+
# Time of purchase with 24 hours formatting (HH:MM).
|
27
|
+
# @return [Mindee::TextField]
|
28
|
+
attr_reader :time
|
29
|
+
# The total amount paid including taxes, discounts, fees, tips, and gratuity.
|
30
|
+
# @return [Mindee::AmountField]
|
31
|
+
attr_reader :total_amount
|
32
|
+
# The total amount excluding taxes.
|
33
|
+
# @return [Mindee::AmountField]
|
34
|
+
attr_reader :total_net
|
35
|
+
# The total amount of taxes.
|
36
|
+
# @return [Mindee::AmountField]
|
37
|
+
attr_reader :total_tax
|
38
|
+
# The total amount of tip and gratuity.
|
39
|
+
# @return [Mindee::AmountField]
|
40
|
+
attr_reader :tip
|
41
|
+
# List of tax lines information including: Amount, tax rate, tax base amount and tax code.
|
42
|
+
# @return [Array<Mindee::TaxField>]
|
43
|
+
attr_reader :taxes
|
44
|
+
# The name of the supplier or merchant.
|
45
|
+
# @return [Mindee::TextField]
|
46
|
+
attr_reader :supplier_name
|
47
|
+
# List of supplier company registrations or identifiers.
|
48
|
+
# @return [Array<Mindee::CompanyRegistration>]
|
49
|
+
attr_reader :supplier_company_registrations
|
50
|
+
# The address of the supplier or merchant returned as a single string.
|
51
|
+
# @return [Mindee::TextField]
|
52
|
+
attr_reader :supplier_address
|
53
|
+
# The Phone number of the supplier or merchant returned as a single string.
|
54
|
+
# @return [Mindee::TextField]
|
55
|
+
attr_reader :supplier_phone_number
|
56
|
+
# Full extraction of lines, including: description, quantity, unit price and total.
|
57
|
+
# @return [Array<Mindee::ReceiptV5LineItem>]
|
58
|
+
attr_reader :line_items
|
59
|
+
|
60
|
+
# @param prediction [Hash]
|
61
|
+
# @param page_id [Integer, nil]
|
62
|
+
def initialize(prediction, page_id)
|
63
|
+
super
|
64
|
+
@locale = Locale.new(prediction['locale'], page_id)
|
65
|
+
@category = TextField.new(prediction['category'], page_id)
|
66
|
+
@subcategory = TextField.new(prediction['subcategory'], page_id)
|
67
|
+
@document_type = TextField.new(prediction['document_type'], page_id)
|
68
|
+
@date = DateField.new(prediction['date'], page_id)
|
69
|
+
@time = TextField.new(prediction['time'], page_id)
|
70
|
+
@total_amount = AmountField.new(prediction['total_amount'], page_id)
|
71
|
+
@total_net = AmountField.new(prediction['total_net'], page_id)
|
72
|
+
@total_tax = AmountField.new(prediction['total_tax'], page_id)
|
73
|
+
@tip = AmountField.new(prediction['tip'], page_id)
|
74
|
+
@taxes = []
|
75
|
+
prediction['taxes'].each do |item|
|
76
|
+
@taxes.push(TaxField.new(item, page_id))
|
77
|
+
end
|
78
|
+
@supplier_name = TextField.new(prediction['supplier_name'], page_id)
|
79
|
+
@supplier_company_registrations = []
|
80
|
+
prediction['supplier_company_registrations'].each do |item|
|
81
|
+
@supplier_company_registrations.push(CompanyRegistration.new(item, page_id))
|
82
|
+
end
|
83
|
+
@supplier_address = TextField.new(prediction['supplier_address'], page_id)
|
84
|
+
@supplier_phone_number = TextField.new(prediction['supplier_phone_number'], page_id)
|
85
|
+
@line_items = []
|
86
|
+
prediction['line_items'].each do |item|
|
87
|
+
@line_items.push(ReceiptV5LineItem.new(item, page_id))
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# @return String
|
92
|
+
def to_s
|
93
|
+
taxes = @taxes.join("\n #{' ' * 7}")
|
94
|
+
supplier_company_registrations = @supplier_company_registrations.join("\n #{' ' * 32}")
|
95
|
+
line_items = line_items_to_s
|
96
|
+
out_str = String.new
|
97
|
+
out_str << "\n:Expense Locale: #{@locale}".rstrip
|
98
|
+
out_str << "\n:Expense Category: #{@category}".rstrip
|
99
|
+
out_str << "\n:Expense Sub Category: #{@subcategory}".rstrip
|
100
|
+
out_str << "\n:Document Type: #{@document_type}".rstrip
|
101
|
+
out_str << "\n:Purchase Date: #{@date}".rstrip
|
102
|
+
out_str << "\n:Purchase Time: #{@time}".rstrip
|
103
|
+
out_str << "\n:Total Amount: #{@total_amount}".rstrip
|
104
|
+
out_str << "\n:Total Excluding Taxes: #{@total_net}".rstrip
|
105
|
+
out_str << "\n:Total Tax: #{@total_tax}".rstrip
|
106
|
+
out_str << "\n:Tip and Gratuity: #{@tip}".rstrip
|
107
|
+
out_str << "\n:Taxes: #{taxes}".rstrip
|
108
|
+
out_str << "\n:Supplier Name: #{@supplier_name}".rstrip
|
109
|
+
out_str << "\n:Supplier Company Registrations: #{supplier_company_registrations}".rstrip
|
110
|
+
out_str << "\n:Supplier Address: #{@supplier_address}".rstrip
|
111
|
+
out_str << "\n:Supplier Phone Number: #{@supplier_phone_number}".rstrip
|
112
|
+
out_str << "\n:Line Items:"
|
113
|
+
out_str << line_items
|
114
|
+
out_str[1..].to_s
|
115
|
+
end
|
116
|
+
|
117
|
+
private
|
118
|
+
|
119
|
+
def line_items_separator(char)
|
120
|
+
" +#{char * 38}+#{char * 10}+#{char * 14}+#{char * 12}+"
|
121
|
+
end
|
122
|
+
|
123
|
+
def line_items_to_s
|
124
|
+
return '' if @line_items.empty?
|
125
|
+
|
126
|
+
line_items = @line_items.map(&:to_s).join("\n#{line_items_separator('-')}\n ")
|
127
|
+
out_str = String.new
|
128
|
+
out_str << "\n#{line_items_separator('-')}"
|
129
|
+
out_str << "\n | Description #{' ' * 25}| Quantity | Total Amount | Unit Price |"
|
130
|
+
out_str << "\n#{line_items_separator('=')}"
|
131
|
+
out_str << "\n #{line_items}"
|
132
|
+
out_str << "\n#{line_items_separator('-')}"
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mindee
|
4
|
+
# Full extraction of lines, including: description, quantity, unit price and total.
|
5
|
+
class ReceiptV5LineItem
|
6
|
+
# The item description.
|
7
|
+
# @return [String]
|
8
|
+
attr_reader :description
|
9
|
+
# The item quantity.
|
10
|
+
# @return [Float]
|
11
|
+
attr_reader :quantity
|
12
|
+
# The item total amount.
|
13
|
+
# @return [Float]
|
14
|
+
attr_reader :total_amount
|
15
|
+
# The item unit price.
|
16
|
+
# @return [Float]
|
17
|
+
attr_reader :unit_price
|
18
|
+
|
19
|
+
def initialize(prediction, page_id)
|
20
|
+
@description = prediction['description']
|
21
|
+
@quantity = prediction['quantity']
|
22
|
+
@total_amount = prediction['total_amount']
|
23
|
+
@unit_price = prediction['unit_price']
|
24
|
+
@page_id = page_id
|
25
|
+
end
|
26
|
+
|
27
|
+
# @return String
|
28
|
+
def to_s
|
29
|
+
out_str = String.new
|
30
|
+
out_str << format('| %- 37s', @description)
|
31
|
+
out_str << format('| %- 9s', Field.float_to_string(@quantity))
|
32
|
+
out_str << format('| %- 13s', Field.float_to_string(@total_amount))
|
33
|
+
out_str << format('| %- 11s', Field.float_to_string(@unit_price))
|
34
|
+
out_str << '|'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -29,8 +29,8 @@ module Mindee
|
|
29
29
|
def to_s
|
30
30
|
out_str = String.new
|
31
31
|
out_str << "\n:Owner: #{@owner}".rstrip
|
32
|
-
out_str << "\n:Serial
|
33
|
-
out_str << "\n:Size and
|
32
|
+
out_str << "\n:Serial Number: #{@serial_number}".rstrip
|
33
|
+
out_str << "\n:Size and Type: #{@size_type}".rstrip
|
34
34
|
out_str[1..].to_s
|
35
35
|
end
|
36
36
|
end
|
@@ -6,6 +6,7 @@ require_relative 'prediction/financial_document/financial_document_v1'
|
|
6
6
|
require_relative 'prediction/invoice/invoice_v4'
|
7
7
|
require_relative 'prediction/passport/passport_v1'
|
8
8
|
require_relative 'prediction/receipt/receipt_v4'
|
9
|
+
require_relative 'prediction/receipt/receipt_v5'
|
9
10
|
require_relative 'prediction/eu/license_plate/license_plate_v1'
|
10
11
|
require_relative 'prediction/shipping_container/shipping_container_v1'
|
11
12
|
require_relative 'prediction/us/bank_check/bank_check_v1'
|
data/lib/mindee/version.rb
CHANGED
data/mindee.gemspec
CHANGED
@@ -30,10 +30,10 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.required_ruby_version = Gem::Requirement.new('>= 2.6')
|
31
31
|
|
32
32
|
spec.add_runtime_dependency 'marcel', '~> 1.0.2'
|
33
|
-
spec.add_runtime_dependency 'origamindee', '~> 3.1'
|
33
|
+
spec.add_runtime_dependency 'origamindee', '~> 3.1.0'
|
34
34
|
|
35
|
-
spec.add_development_dependency 'rake', '~> 12.3'
|
36
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
37
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
38
|
-
spec.add_development_dependency 'yard', '~> 0.9'
|
35
|
+
spec.add_development_dependency 'rake', '~> 12.3.3'
|
36
|
+
spec.add_development_dependency 'rspec', '~> 3.12.0'
|
37
|
+
spec.add_development_dependency 'rubocop', '~> 1.49.0'
|
38
|
+
spec.add_development_dependency 'yard', '~> 0.9.34'
|
39
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mindee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mindee, SA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: marcel
|
@@ -30,70 +30,70 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 3.1.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 3.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 12.3.3
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 12.3.3
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 3.12.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 3.12.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 1.49.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 1.49.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: yard
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 0.9.34
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 0.9.34
|
97
97
|
description: Quickly and easily connect to Mindee's API services using Ruby.
|
98
98
|
email:
|
99
99
|
- devrel@mindee.co
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- docs/code_samples/custom_v1.txt
|
124
124
|
- docs/code_samples/default.txt
|
125
125
|
- docs/code_samples/expense_receipts_v4.txt
|
126
|
+
- docs/code_samples/expense_receipts_v5.txt
|
126
127
|
- docs/code_samples/financial_document_v1.txt
|
127
128
|
- docs/code_samples/idcard_fr_v1.txt
|
128
129
|
- docs/code_samples/invoices_v4.txt
|
@@ -164,15 +165,17 @@ files:
|
|
164
165
|
- lib/mindee/parsing/prediction/custom/fields.rb
|
165
166
|
- lib/mindee/parsing/prediction/eu/license_plate/license_plate_v1.rb
|
166
167
|
- lib/mindee/parsing/prediction/financial_document/financial_document_v1.rb
|
167
|
-
- lib/mindee/parsing/prediction/financial_document/
|
168
|
+
- lib/mindee/parsing/prediction/financial_document/financial_document_v1_line_item.rb
|
168
169
|
- lib/mindee/parsing/prediction/fr/bank_account_details/bank_account_details_v1.rb
|
169
170
|
- lib/mindee/parsing/prediction/fr/carte_vitale/carte_vitale_v1.rb
|
170
171
|
- lib/mindee/parsing/prediction/fr/id_card/id_card_v1.rb
|
171
|
-
- lib/mindee/parsing/prediction/invoice/invoice_line_item.rb
|
172
172
|
- lib/mindee/parsing/prediction/invoice/invoice_v4.rb
|
173
|
+
- lib/mindee/parsing/prediction/invoice/invoice_v4_line_item.rb
|
173
174
|
- lib/mindee/parsing/prediction/passport/passport_v1.rb
|
174
175
|
- lib/mindee/parsing/prediction/proof_of_address/proof_of_address_v1.rb
|
175
176
|
- lib/mindee/parsing/prediction/receipt/receipt_v4.rb
|
177
|
+
- lib/mindee/parsing/prediction/receipt/receipt_v5.rb
|
178
|
+
- lib/mindee/parsing/prediction/receipt/receipt_v5_line_item.rb
|
176
179
|
- lib/mindee/parsing/prediction/shipping_container/shipping_container_v1.rb
|
177
180
|
- lib/mindee/parsing/prediction/us/bank_check/bank_check_v1.rb
|
178
181
|
- lib/mindee/version.rb
|