mindee 3.1.1 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -0
- data/CHANGELOG.md +26 -0
- data/README.md +57 -7
- data/bin/mindee.rb +160 -83
- data/docs/bank_account_details_v2.md +137 -0
- data/docs/bank_check_v1.md +179 -0
- data/docs/barcode_reader_v1.md +104 -0
- data/docs/carte_grise_v1.md +454 -0
- data/docs/carte_vitale_v1.md +123 -0
- data/docs/code_samples/barcode_reader_v1.txt +19 -0
- data/docs/code_samples/carte_grise_v1.txt +19 -0
- data/docs/code_samples/cropper_v1.txt +16 -0
- data/docs/code_samples/idcard_fr_v2.txt +19 -0
- data/docs/code_samples/invoice_splitter_v1_async.txt +6 -54
- data/docs/code_samples/multi_receipts_detector_v1.txt +19 -0
- data/docs/code_samples/us_w9_v1.txt +16 -0
- data/docs/cropper_v1.md +97 -0
- data/docs/custom_v1.md +109 -0
- data/docs/expense_receipts_v5.md +306 -0
- data/docs/financial_document_v1.md +384 -0
- data/docs/{ruby-getting-started.md → getting_started.md} +22 -6
- data/docs/idcard_fr_v2.md +253 -0
- data/docs/invoice_splitter_v1.md +85 -0
- data/docs/invoices_v4.md +338 -0
- data/docs/license_plates_v1.md +91 -0
- data/docs/multi_receipts_detector_v1.md +105 -0
- data/docs/passport_v1.md +186 -0
- data/docs/proof_of_address_v1.md +207 -0
- data/docs/us_driver_license_v1.md +268 -0
- data/docs/us_w9_v1.md +207 -0
- data/lib/mindee/client.rb +95 -16
- data/lib/mindee/geometry/quadrilateral.rb +5 -0
- data/lib/mindee/http/.rubocop.yml +8 -0
- data/lib/mindee/http/endpoint.rb +19 -7
- data/lib/mindee/http/error.rb +104 -0
- data/lib/mindee/http.rb +1 -0
- data/lib/mindee/input/sources.rb +83 -14
- data/lib/mindee/parsing/common/api_response.rb +12 -1
- data/lib/mindee/parsing/common/document.rb +4 -1
- data/lib/mindee/parsing/common/inference.rb +2 -2
- data/lib/mindee/parsing/common/ocr/ocr.rb +1 -0
- data/lib/mindee/parsing/common.rb +0 -1
- data/lib/mindee/parsing/custom/list_field.rb +7 -5
- data/lib/mindee/parsing/standard/base_field.rb +1 -1
- data/lib/mindee/parsing/standard/company_registration_field.rb +1 -1
- data/lib/mindee/parsing/standard/locale_field.rb +1 -1
- data/lib/mindee/parsing/standard/payment_details_field.rb +1 -1
- data/lib/mindee/parsing/standard/position_field.rb +10 -3
- data/lib/mindee/parsing/standard/{text_field.rb → string_field.rb} +1 -1
- data/lib/mindee/parsing/standard.rb +1 -1
- data/lib/mindee/pdf/pdf_processing.rb +2 -1
- data/lib/mindee/product/barcode_reader/barcode_reader_v1.rb +37 -0
- data/lib/mindee/product/barcode_reader/barcode_reader_v1_document.rb +44 -0
- data/lib/mindee/product/barcode_reader/barcode_reader_v1_page.rb +32 -0
- data/lib/mindee/product/cropper/cropper_v1.rb +37 -0
- data/lib/mindee/product/cropper/cropper_v1_document.rb +13 -0
- data/lib/mindee/product/cropper/cropper_v1_page.rb +49 -0
- data/lib/mindee/product/custom/custom_v1.rb +1 -0
- data/lib/mindee/product/eu/license_plate/license_plate_v1.rb +1 -0
- data/lib/mindee/product/eu/license_plate/license_plate_v1_document.rb +2 -2
- data/lib/mindee/product/financial_document/financial_document_v1.rb +1 -0
- data/lib/mindee/product/financial_document/financial_document_v1_document.rb +26 -26
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1.rb +1 -0
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1_document.rb +6 -6
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2.rb +1 -0
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_document.rb +6 -6
- data/lib/mindee/product/fr/carte_grise/carte_grise_v1.rb +39 -0
- data/lib/mindee/product/fr/carte_grise/carte_grise_v1_document.rb +235 -0
- data/lib/mindee/product/fr/carte_grise/carte_grise_v1_page.rb +34 -0
- data/lib/mindee/product/fr/carte_vitale/carte_vitale_v1.rb +1 -0
- data/lib/mindee/product/fr/carte_vitale/carte_vitale_v1_document.rb +6 -6
- data/lib/mindee/product/fr/id_card/id_card_v1.rb +1 -0
- data/lib/mindee/product/fr/id_card/id_card_v1_document.rb +16 -16
- data/lib/mindee/product/fr/id_card/id_card_v2.rb +39 -0
- data/lib/mindee/product/fr/id_card/id_card_v2_document.rb +107 -0
- data/lib/mindee/product/fr/id_card/id_card_v2_page.rb +53 -0
- data/lib/mindee/product/invoice/invoice_v4.rb +2 -2
- data/lib/mindee/product/invoice/invoice_v4_document.rb +115 -155
- data/lib/mindee/product/invoice/invoice_v4_line_item.rb +54 -30
- data/lib/mindee/product/invoice_splitter/invoice_splitter_v1.rb +1 -0
- data/lib/mindee/product/invoice_splitter/invoice_splitter_v1_document.rb +5 -3
- data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1.rb +37 -0
- data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rb +35 -0
- data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_page.rb +32 -0
- data/lib/mindee/product/passport/passport_v1.rb +1 -0
- data/lib/mindee/product/passport/passport_v1_document.rb +16 -16
- data/lib/mindee/product/proof_of_address/proof_of_address_v1.rb +1 -0
- data/lib/mindee/product/proof_of_address/proof_of_address_v1_document.rb +14 -14
- data/lib/mindee/product/receipt/receipt_v4_document.rb +6 -6
- data/lib/mindee/product/receipt/receipt_v5.rb +1 -0
- data/lib/mindee/product/receipt/receipt_v5_document.rb +12 -12
- data/lib/mindee/product/us/bank_check/bank_check_v1.rb +1 -0
- data/lib/mindee/product/us/bank_check/bank_check_v1_document.rb +8 -8
- data/lib/mindee/product/us/driver_license/driver_license_v1.rb +1 -0
- data/lib/mindee/product/us/driver_license/driver_license_v1_document.rb +28 -28
- data/lib/mindee/product/us/w9/w9_v1.rb +39 -0
- data/lib/mindee/product/us/w9/w9_v1_document.rb +15 -0
- data/lib/mindee/product/us/w9/w9_v1_page.rb +102 -0
- data/lib/mindee/product.rb +6 -0
- data/lib/mindee/version.rb +5 -1
- data/lib/mindee.rb +45 -1
- metadata +48 -9
- data/docs/ruby-api-builder.md +0 -123
- data/docs/ruby-invoice-ocr.md +0 -271
- data/docs/ruby-passport-ocr.md +0 -165
- data/docs/ruby-receipt-ocr.md +0 -196
- data/lib/mindee/parsing/common/error.rb +0 -24
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../../../parsing'
|
|
4
|
+
require_relative 'w9_v1_document'
|
|
5
|
+
|
|
6
|
+
module Mindee
|
|
7
|
+
module Product
|
|
8
|
+
module US
|
|
9
|
+
module W9
|
|
10
|
+
# W9 V1 page.
|
|
11
|
+
class W9V1Page < Mindee::Parsing::Common::Page
|
|
12
|
+
# @param prediction [Hash]
|
|
13
|
+
def initialize(prediction)
|
|
14
|
+
super(prediction)
|
|
15
|
+
@prediction = W9V1PagePrediction.new(
|
|
16
|
+
prediction['prediction'],
|
|
17
|
+
prediction['id']
|
|
18
|
+
)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# W9 V1 page prediction.
|
|
23
|
+
class W9V1PagePrediction < W9V1Document
|
|
24
|
+
include Mindee::Parsing::Standard
|
|
25
|
+
|
|
26
|
+
# The street address (number, street, and apt. or suite no.) of the applicant.
|
|
27
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
28
|
+
attr_reader :address
|
|
29
|
+
# The business name or disregarded entity name, if different from Name.
|
|
30
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
31
|
+
attr_reader :business_name
|
|
32
|
+
# The city, state, and ZIP code of the applicant.
|
|
33
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
34
|
+
attr_reader :city_state_zip
|
|
35
|
+
# The employer identification number.
|
|
36
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
37
|
+
attr_reader :ein
|
|
38
|
+
# Name as shown on the applicant's income tax return.
|
|
39
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
40
|
+
attr_reader :name
|
|
41
|
+
# Position of the signature date on the document.
|
|
42
|
+
# @return [Mindee::Parsing::Standard::PositionField]
|
|
43
|
+
attr_reader :signature_date_position
|
|
44
|
+
# Position of the signature on the document.
|
|
45
|
+
# @return [Mindee::Parsing::Standard::PositionField]
|
|
46
|
+
attr_reader :signature_position
|
|
47
|
+
# The applicant's social security number.
|
|
48
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
49
|
+
attr_reader :ssn
|
|
50
|
+
# The federal tax classification, which can vary depending on the revision date.
|
|
51
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
52
|
+
attr_reader :tax_classification
|
|
53
|
+
# Depending on revision year, among S, C, P or D for Limited Liability Company Classification.
|
|
54
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
55
|
+
attr_reader :tax_classification_llc
|
|
56
|
+
# Tax Classification Other Details.
|
|
57
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
58
|
+
attr_reader :tax_classification_other_details
|
|
59
|
+
# The Revision month and year of the W9 form.
|
|
60
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
61
|
+
attr_reader :w9_revision_date
|
|
62
|
+
|
|
63
|
+
# @param prediction [Hash]
|
|
64
|
+
# @param page_id [Integer, nil]
|
|
65
|
+
def initialize(prediction, page_id)
|
|
66
|
+
@address = StringField.new(prediction['address'], page_id)
|
|
67
|
+
@business_name = StringField.new(prediction['business_name'], page_id)
|
|
68
|
+
@city_state_zip = StringField.new(prediction['city_state_zip'], page_id)
|
|
69
|
+
@ein = StringField.new(prediction['ein'], page_id)
|
|
70
|
+
@name = StringField.new(prediction['name'], page_id)
|
|
71
|
+
@signature_date_position = PositionField.new(prediction['signature_date_position'], page_id)
|
|
72
|
+
@signature_position = PositionField.new(prediction['signature_position'], page_id)
|
|
73
|
+
@ssn = StringField.new(prediction['ssn'], page_id)
|
|
74
|
+
@tax_classification = StringField.new(prediction['tax_classification'], page_id)
|
|
75
|
+
@tax_classification_llc = StringField.new(prediction['tax_classification_llc'], page_id)
|
|
76
|
+
@tax_classification_other_details = StringField.new(prediction['tax_classification_other_details'], page_id)
|
|
77
|
+
@w9_revision_date = StringField.new(prediction['w9_revision_date'], page_id)
|
|
78
|
+
super()
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# @return [String]
|
|
82
|
+
def to_s
|
|
83
|
+
out_str = String.new
|
|
84
|
+
out_str << "\n:Name: #{@name}".rstrip
|
|
85
|
+
out_str << "\n:SSN: #{@ssn}".rstrip
|
|
86
|
+
out_str << "\n:Address: #{@address}".rstrip
|
|
87
|
+
out_str << "\n:City State Zip: #{@city_state_zip}".rstrip
|
|
88
|
+
out_str << "\n:Business Name: #{@business_name}".rstrip
|
|
89
|
+
out_str << "\n:EIN: #{@ein}".rstrip
|
|
90
|
+
out_str << "\n:Tax Classification: #{@tax_classification}".rstrip
|
|
91
|
+
out_str << "\n:Tax Classification Other Details: #{@tax_classification_other_details}".rstrip
|
|
92
|
+
out_str << "\n:W9 Revision Date: #{@w9_revision_date}".rstrip
|
|
93
|
+
out_str << "\n:Signature Position: #{@signature_position}".rstrip
|
|
94
|
+
out_str << "\n:Signature Date Position: #{@signature_date_position}".rstrip
|
|
95
|
+
out_str << "\n:Tax Classification LLC: #{@tax_classification_llc}".rstrip
|
|
96
|
+
out_str
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
data/lib/mindee/product.rb
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative 'product/barcode_reader/barcode_reader_v1'
|
|
3
4
|
require_relative 'product/custom/custom_v1'
|
|
4
5
|
require_relative 'product/proof_of_address/proof_of_address_v1'
|
|
5
6
|
require_relative 'product/financial_document/financial_document_v1'
|
|
6
7
|
require_relative 'product/invoice/invoice_v4'
|
|
8
|
+
require_relative 'product/cropper/cropper_v1'
|
|
9
|
+
require_relative 'product/multi_receipts_detector/multi_receipts_detector_v1'
|
|
7
10
|
require_relative 'product/passport/passport_v1'
|
|
8
11
|
require_relative 'product/receipt/receipt_v4'
|
|
9
12
|
require_relative 'product/receipt/receipt_v5'
|
|
@@ -12,6 +15,9 @@ require_relative 'product/fr/bank_account_details/bank_account_details_v1'
|
|
|
12
15
|
require_relative 'product/fr/bank_account_details/bank_account_details_v2'
|
|
13
16
|
require_relative 'product/fr/carte_vitale/carte_vitale_v1'
|
|
14
17
|
require_relative 'product/fr/id_card/id_card_v1'
|
|
18
|
+
require_relative 'product/fr/id_card/id_card_v2'
|
|
19
|
+
require_relative 'product/fr/carte_grise/carte_grise_v1'
|
|
15
20
|
require_relative 'product/invoice_splitter/invoice_splitter_v1'
|
|
16
21
|
require_relative 'product/us/bank_check/bank_check_v1'
|
|
17
22
|
require_relative 'product/us/driver_license/driver_license_v1'
|
|
23
|
+
require_relative 'product/us/w9/w9_v1'
|
data/lib/mindee/version.rb
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
# Mindee
|
|
4
4
|
module Mindee
|
|
5
|
-
|
|
5
|
+
# Current version.
|
|
6
|
+
VERSION = '3.3.0'
|
|
6
7
|
|
|
8
|
+
# Finds and return the current platform.
|
|
7
9
|
# @return [String]
|
|
8
10
|
def self.find_platform
|
|
9
11
|
host = RbConfig::CONFIG['host_os']
|
|
@@ -18,5 +20,7 @@ module Mindee
|
|
|
18
20
|
return os unless (regexp =~ host).nil?
|
|
19
21
|
end
|
|
20
22
|
end
|
|
23
|
+
|
|
24
|
+
# Current platform.
|
|
21
25
|
PLATFORM = find_platform.freeze
|
|
22
26
|
end
|
data/lib/mindee.rb
CHANGED
|
@@ -3,8 +3,52 @@
|
|
|
3
3
|
require 'mindee/client'
|
|
4
4
|
|
|
5
5
|
module Mindee
|
|
6
|
+
# Mindee internal http module.
|
|
6
7
|
module HTTP
|
|
7
|
-
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# PDF-specific operations.
|
|
11
|
+
module PDF
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Document handling.
|
|
15
|
+
module Input
|
|
16
|
+
# Document source handling.
|
|
17
|
+
module Source
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Parsing internals and fields.
|
|
22
|
+
module Parsing
|
|
23
|
+
# Common fields and functions.
|
|
24
|
+
module Common
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Custom fields and functions.
|
|
28
|
+
module Custom
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Standard fields and functions.
|
|
32
|
+
module Standard
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Document input-related internals.
|
|
37
|
+
module Input
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Collection of all internal products.
|
|
41
|
+
module Product
|
|
42
|
+
# Europe-specific products.
|
|
43
|
+
module EU
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# France-specific products.
|
|
47
|
+
module FR
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# US-specific products.
|
|
51
|
+
module US
|
|
8
52
|
end
|
|
9
53
|
end
|
|
10
54
|
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: 3.
|
|
4
|
+
version: 3.3.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-11-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: marcel
|
|
@@ -117,27 +117,47 @@ files:
|
|
|
117
117
|
- Rakefile
|
|
118
118
|
- bin/console
|
|
119
119
|
- bin/mindee.rb
|
|
120
|
+
- docs/bank_account_details_v2.md
|
|
121
|
+
- docs/bank_check_v1.md
|
|
122
|
+
- docs/barcode_reader_v1.md
|
|
123
|
+
- docs/carte_grise_v1.md
|
|
124
|
+
- docs/carte_vitale_v1.md
|
|
120
125
|
- docs/code_samples/bank_account_details_v1.txt
|
|
121
126
|
- docs/code_samples/bank_account_details_v2.txt
|
|
122
127
|
- docs/code_samples/bank_check_v1.txt
|
|
128
|
+
- docs/code_samples/barcode_reader_v1.txt
|
|
129
|
+
- docs/code_samples/carte_grise_v1.txt
|
|
123
130
|
- docs/code_samples/carte_vitale_v1.txt
|
|
131
|
+
- docs/code_samples/cropper_v1.txt
|
|
124
132
|
- docs/code_samples/custom_v1.txt
|
|
125
133
|
- docs/code_samples/default.txt
|
|
126
134
|
- docs/code_samples/expense_receipts_v4.txt
|
|
127
135
|
- docs/code_samples/expense_receipts_v5.txt
|
|
128
136
|
- docs/code_samples/financial_document_v1.txt
|
|
129
137
|
- docs/code_samples/idcard_fr_v1.txt
|
|
138
|
+
- docs/code_samples/idcard_fr_v2.txt
|
|
130
139
|
- docs/code_samples/invoice_splitter_v1_async.txt
|
|
131
140
|
- docs/code_samples/invoices_v4.txt
|
|
132
141
|
- docs/code_samples/license_plates_v1.txt
|
|
142
|
+
- docs/code_samples/multi_receipts_detector_v1.txt
|
|
133
143
|
- docs/code_samples/passport_v1.txt
|
|
134
144
|
- docs/code_samples/proof_of_address_v1.txt
|
|
135
145
|
- docs/code_samples/us_driver_license_v1.txt
|
|
136
|
-
- docs/
|
|
137
|
-
- docs/
|
|
138
|
-
- docs/
|
|
139
|
-
- docs/
|
|
140
|
-
- docs/
|
|
146
|
+
- docs/code_samples/us_w9_v1.txt
|
|
147
|
+
- docs/cropper_v1.md
|
|
148
|
+
- docs/custom_v1.md
|
|
149
|
+
- docs/expense_receipts_v5.md
|
|
150
|
+
- docs/financial_document_v1.md
|
|
151
|
+
- docs/getting_started.md
|
|
152
|
+
- docs/idcard_fr_v2.md
|
|
153
|
+
- docs/invoice_splitter_v1.md
|
|
154
|
+
- docs/invoices_v4.md
|
|
155
|
+
- docs/license_plates_v1.md
|
|
156
|
+
- docs/multi_receipts_detector_v1.md
|
|
157
|
+
- docs/passport_v1.md
|
|
158
|
+
- docs/proof_of_address_v1.md
|
|
159
|
+
- docs/us_driver_license_v1.md
|
|
160
|
+
- docs/us_w9_v1.md
|
|
141
161
|
- lib/mindee.rb
|
|
142
162
|
- lib/mindee/client.rb
|
|
143
163
|
- lib/mindee/geometry.rb
|
|
@@ -147,14 +167,15 @@ files:
|
|
|
147
167
|
- lib/mindee/geometry/quadrilateral.rb
|
|
148
168
|
- lib/mindee/geometry/utils.rb
|
|
149
169
|
- lib/mindee/http.rb
|
|
170
|
+
- lib/mindee/http/.rubocop.yml
|
|
150
171
|
- lib/mindee/http/endpoint.rb
|
|
172
|
+
- lib/mindee/http/error.rb
|
|
151
173
|
- lib/mindee/input.rb
|
|
152
174
|
- lib/mindee/input/sources.rb
|
|
153
175
|
- lib/mindee/parsing.rb
|
|
154
176
|
- lib/mindee/parsing/common.rb
|
|
155
177
|
- lib/mindee/parsing/common/api_response.rb
|
|
156
178
|
- lib/mindee/parsing/common/document.rb
|
|
157
|
-
- lib/mindee/parsing/common/error.rb
|
|
158
179
|
- lib/mindee/parsing/common/inference.rb
|
|
159
180
|
- lib/mindee/parsing/common/ocr.rb
|
|
160
181
|
- lib/mindee/parsing/common/ocr/mvision_v1.rb
|
|
@@ -175,13 +196,19 @@ files:
|
|
|
175
196
|
- lib/mindee/parsing/standard/locale_field.rb
|
|
176
197
|
- lib/mindee/parsing/standard/payment_details_field.rb
|
|
177
198
|
- lib/mindee/parsing/standard/position_field.rb
|
|
199
|
+
- lib/mindee/parsing/standard/string_field.rb
|
|
178
200
|
- lib/mindee/parsing/standard/tax_field.rb
|
|
179
|
-
- lib/mindee/parsing/standard/text_field.rb
|
|
180
201
|
- lib/mindee/pdf.rb
|
|
181
202
|
- lib/mindee/pdf/pdf_processing.rb
|
|
182
203
|
- lib/mindee/pdf/pdf_tools.rb
|
|
183
204
|
- lib/mindee/product.rb
|
|
184
205
|
- lib/mindee/product/.rubocop.yml
|
|
206
|
+
- lib/mindee/product/barcode_reader/barcode_reader_v1.rb
|
|
207
|
+
- lib/mindee/product/barcode_reader/barcode_reader_v1_document.rb
|
|
208
|
+
- lib/mindee/product/barcode_reader/barcode_reader_v1_page.rb
|
|
209
|
+
- lib/mindee/product/cropper/cropper_v1.rb
|
|
210
|
+
- lib/mindee/product/cropper/cropper_v1_document.rb
|
|
211
|
+
- lib/mindee/product/cropper/cropper_v1_page.rb
|
|
185
212
|
- lib/mindee/product/custom/custom_v1.rb
|
|
186
213
|
- lib/mindee/product/custom/custom_v1_document.rb
|
|
187
214
|
- lib/mindee/product/custom/custom_v1_page.rb
|
|
@@ -199,12 +226,18 @@ files:
|
|
|
199
226
|
- lib/mindee/product/fr/bank_account_details/bank_account_details_v2_bban.rb
|
|
200
227
|
- lib/mindee/product/fr/bank_account_details/bank_account_details_v2_document.rb
|
|
201
228
|
- lib/mindee/product/fr/bank_account_details/bank_account_details_v2_page.rb
|
|
229
|
+
- lib/mindee/product/fr/carte_grise/carte_grise_v1.rb
|
|
230
|
+
- lib/mindee/product/fr/carte_grise/carte_grise_v1_document.rb
|
|
231
|
+
- lib/mindee/product/fr/carte_grise/carte_grise_v1_page.rb
|
|
202
232
|
- lib/mindee/product/fr/carte_vitale/carte_vitale_v1.rb
|
|
203
233
|
- lib/mindee/product/fr/carte_vitale/carte_vitale_v1_document.rb
|
|
204
234
|
- lib/mindee/product/fr/carte_vitale/carte_vitale_v1_page.rb
|
|
205
235
|
- lib/mindee/product/fr/id_card/id_card_v1.rb
|
|
206
236
|
- lib/mindee/product/fr/id_card/id_card_v1_document.rb
|
|
207
237
|
- lib/mindee/product/fr/id_card/id_card_v1_page.rb
|
|
238
|
+
- lib/mindee/product/fr/id_card/id_card_v2.rb
|
|
239
|
+
- lib/mindee/product/fr/id_card/id_card_v2_document.rb
|
|
240
|
+
- lib/mindee/product/fr/id_card/id_card_v2_page.rb
|
|
208
241
|
- lib/mindee/product/invoice/invoice_v4.rb
|
|
209
242
|
- lib/mindee/product/invoice/invoice_v4_document.rb
|
|
210
243
|
- lib/mindee/product/invoice/invoice_v4_line_item.rb
|
|
@@ -212,6 +245,9 @@ files:
|
|
|
212
245
|
- lib/mindee/product/invoice_splitter/invoice_splitter_v1.rb
|
|
213
246
|
- lib/mindee/product/invoice_splitter/invoice_splitter_v1_document.rb
|
|
214
247
|
- lib/mindee/product/invoice_splitter/invoice_splitter_v1_page.rb
|
|
248
|
+
- lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1.rb
|
|
249
|
+
- lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rb
|
|
250
|
+
- lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_page.rb
|
|
215
251
|
- lib/mindee/product/passport/passport_v1.rb
|
|
216
252
|
- lib/mindee/product/passport/passport_v1_document.rb
|
|
217
253
|
- lib/mindee/product/passport/passport_v1_page.rb
|
|
@@ -231,6 +267,9 @@ files:
|
|
|
231
267
|
- lib/mindee/product/us/driver_license/driver_license_v1.rb
|
|
232
268
|
- lib/mindee/product/us/driver_license/driver_license_v1_document.rb
|
|
233
269
|
- lib/mindee/product/us/driver_license/driver_license_v1_page.rb
|
|
270
|
+
- lib/mindee/product/us/w9/w9_v1.rb
|
|
271
|
+
- lib/mindee/product/us/w9/w9_v1_document.rb
|
|
272
|
+
- lib/mindee/product/us/w9/w9_v1_page.rb
|
|
234
273
|
- lib/mindee/version.rb
|
|
235
274
|
- mindee.gemspec
|
|
236
275
|
homepage: https://github.com/mindee/mindee-api-ruby
|
data/docs/ruby-api-builder.md
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
The Ruby OCR SDK supports [custom-built API](https://developers.mindee.com/docs/build-your-first-document-parsing-api) from the API Builder.
|
|
2
|
-
|
|
3
|
-
If your document isn't covered by one of Mindee's Off-the-Shelf APIs, you can create your own API using the
|
|
4
|
-
[API Builder](https://developers.mindee.com/docs/overview).
|
|
5
|
-
|
|
6
|
-
For the following examples, we are using our own [W9s custom API](https://developers.mindee.com/docs/w9-forms-ocr),
|
|
7
|
-
created with the [API Builder](https://developers.mindee.com/docs/overview).
|
|
8
|
-
|
|
9
|
-
> 📘 **Info**
|
|
10
|
-
>
|
|
11
|
-
> We used a data model that will be different from yours.
|
|
12
|
-
> To modify this to your own custom API, change the `mindee_client.create_endpoint` call with your own parameters.
|
|
13
|
-
|
|
14
|
-
```ruby
|
|
15
|
-
require 'mindee'
|
|
16
|
-
|
|
17
|
-
# Init a new client and configure your custom document
|
|
18
|
-
mindee_client = Mindee::Client.new(api_key: 'my-api-key')
|
|
19
|
-
|
|
20
|
-
# Create an endpoint for your custom product
|
|
21
|
-
custom_endpoint = mindee_client.create_endpoint(
|
|
22
|
-
account_name: 'john',
|
|
23
|
-
endpoint_name: 'wnine',
|
|
24
|
-
version: '1.1' # optional, if not set, uses the latest version of the model
|
|
25
|
-
)
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
> **Note:** If the `version` argument is set, you'll be required to update it every time a new model is trained.
|
|
29
|
-
> This is probably not needed for development but essential for production use.
|
|
30
|
-
|
|
31
|
-
## Parsing Documents
|
|
32
|
-
The client calls the `parse` method when parsing your custom document, which will return an object that you can send to the API.
|
|
33
|
-
If your document is not an OTS API, the document's endpoint must be specified when calling the `parse` method.
|
|
34
|
-
|
|
35
|
-
```ruby
|
|
36
|
-
mindee_client.parse(
|
|
37
|
-
input_source,
|
|
38
|
-
Mindee::Product::Custom::CustomV1,
|
|
39
|
-
endpoint: custom_endpoint
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
# Print a summary of the document prediction in RST format
|
|
44
|
-
puts result.document
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
> 📘 **Info**
|
|
48
|
-
>
|
|
49
|
-
> If your custom document has the same name as one of the [off-the-shelf APIs](https://developers.mindee.com/docs/what-is-off-the-shelf-api) document,
|
|
50
|
-
> you **must** specify your account name when creating the `create_endpoint` method:
|
|
51
|
-
|
|
52
|
-
```ruby
|
|
53
|
-
custom_endpoint = mindee_client.create_endpoint(
|
|
54
|
-
endpoint_name: 'receipt',
|
|
55
|
-
account_name: 'john'
|
|
56
|
-
)
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Document Fields
|
|
60
|
-
All the fields defined in the API builder when creating your custom document are available.
|
|
61
|
-
|
|
62
|
-
In custom documents, each field will hold an array of all the words in the document which are related to that field.
|
|
63
|
-
Each word is an object that has the text content, geometry information, and confidence score.
|
|
64
|
-
|
|
65
|
-
Value fields can be accessed via the `fields` attribute.
|
|
66
|
-
|
|
67
|
-
Classification fields can be accessed via the `classifications` attribute.
|
|
68
|
-
|
|
69
|
-
> 📘 **Info**
|
|
70
|
-
>
|
|
71
|
-
> Both document level and page level objects work in the same way.
|
|
72
|
-
|
|
73
|
-
### Fields Attribute
|
|
74
|
-
The `fields` attribute is a hashmap with the following structure:
|
|
75
|
-
|
|
76
|
-
* key: the API name of the field, as a `symbol`
|
|
77
|
-
* value: a `ListField` object which has a `values` attribute, containing a list of all values found for the field.
|
|
78
|
-
|
|
79
|
-
Individual field values can be accessed by using the field's API name, in the examples below we'll use the `address` field.
|
|
80
|
-
|
|
81
|
-
```ruby
|
|
82
|
-
# raw data, list of each word object
|
|
83
|
-
pp result.document.inference.prediction.fields[:address].values
|
|
84
|
-
|
|
85
|
-
# list of all values
|
|
86
|
-
puts result.document.inference.prediction.fields[:address].contents_list
|
|
87
|
-
|
|
88
|
-
# default string representation
|
|
89
|
-
puts result.document.inference.prediction.fields[:address].to_s
|
|
90
|
-
|
|
91
|
-
# custom string representation
|
|
92
|
-
puts result.document.inference.prediction.fields[:address].contents_str(separator: '_')
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
To iterate over all the fields:
|
|
96
|
-
```ruby
|
|
97
|
-
result.document.inference.prediction.fields.each do |name, info|
|
|
98
|
-
puts name
|
|
99
|
-
puts info.values
|
|
100
|
-
end
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### Classifications Attribute
|
|
104
|
-
The `classifications` attribute is a hashmap with the following structure:
|
|
105
|
-
|
|
106
|
-
* key: the API name of the field, as a `symbol`
|
|
107
|
-
* value: a `ClassificationField` object which has a `value` attribute, containing a string representation of the detected classification.
|
|
108
|
-
|
|
109
|
-
```ruby
|
|
110
|
-
# raw data, list of each word object
|
|
111
|
-
puts result.document.classifications[:doc_type].value
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
To iterate over all the classifications:
|
|
115
|
-
```ruby
|
|
116
|
-
result.document.classifications.each do |name, info|
|
|
117
|
-
puts name
|
|
118
|
-
puts info.value
|
|
119
|
-
end
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
## Questions?
|
|
123
|
-
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
|