mindee 2.2.0 → 3.0.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 (152) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +2 -0
  4. data/.yardopts +1 -0
  5. data/CHANGELOG.md +36 -0
  6. data/README.md +29 -16
  7. data/bin/mindee.rb +23 -26
  8. data/docs/code_samples/bank_account_details_v1.txt +10 -5
  9. data/docs/code_samples/bank_account_details_v2.txt +19 -0
  10. data/docs/code_samples/bank_check_v1.txt +10 -5
  11. data/docs/code_samples/carte_vitale_v1.txt +10 -5
  12. data/docs/code_samples/custom_v1.txt +19 -10
  13. data/docs/code_samples/default.txt +10 -2
  14. data/docs/code_samples/expense_receipts_v4.txt +10 -5
  15. data/docs/code_samples/expense_receipts_v5.txt +11 -6
  16. data/docs/code_samples/financial_document_v1.txt +10 -5
  17. data/docs/code_samples/idcard_fr_v1.txt +10 -5
  18. data/docs/code_samples/invoice_splitter_v1_async.txt +66 -0
  19. data/docs/code_samples/invoices_v4.txt +10 -5
  20. data/docs/code_samples/license_plates_v1.txt +10 -5
  21. data/docs/code_samples/passport_v1.txt +10 -5
  22. data/docs/code_samples/proof_of_address_v1.txt +10 -5
  23. data/docs/ruby-api-builder.md +30 -31
  24. data/docs/ruby-getting-started.md +64 -23
  25. data/docs/ruby-invoice-ocr.md +70 -59
  26. data/docs/ruby-passport-ocr.md +49 -40
  27. data/docs/ruby-receipt-ocr.md +45 -32
  28. data/lib/mindee/client.rb +150 -148
  29. data/lib/mindee/geometry/min_max.rb +23 -0
  30. data/lib/mindee/geometry/point.rb +35 -0
  31. data/lib/mindee/geometry/polygon.rb +23 -0
  32. data/lib/mindee/geometry/quadrilateral.rb +45 -0
  33. data/lib/mindee/geometry/utils.rb +81 -0
  34. data/lib/mindee/geometry.rb +5 -116
  35. data/lib/mindee/http/endpoint.rb +123 -16
  36. data/lib/mindee/http.rb +3 -0
  37. data/lib/mindee/input/sources.rb +87 -73
  38. data/lib/mindee/parsing/common/api_response.rb +109 -0
  39. data/lib/mindee/parsing/common/document.rb +48 -0
  40. data/lib/mindee/parsing/common/error.rb +24 -0
  41. data/lib/mindee/parsing/common/inference.rb +43 -0
  42. data/lib/mindee/parsing/common/ocr/mvision_v1.rb +34 -0
  43. data/lib/mindee/parsing/common/ocr/ocr.rb +169 -0
  44. data/lib/mindee/parsing/common/ocr.rb +3 -0
  45. data/lib/mindee/parsing/common/orientation.rb +26 -0
  46. data/lib/mindee/parsing/common/page.rb +40 -0
  47. data/lib/mindee/parsing/common/prediction.rb +15 -0
  48. data/lib/mindee/parsing/common/product.rb +19 -0
  49. data/lib/mindee/parsing/common.rb +10 -0
  50. data/lib/mindee/parsing/custom/classification_field.rb +28 -0
  51. data/lib/mindee/parsing/custom/list_field.rb +76 -0
  52. data/lib/mindee/parsing/custom.rb +4 -0
  53. data/lib/mindee/parsing/standard/amount_field.rb +26 -0
  54. data/lib/mindee/parsing/standard/base_field.rb +104 -0
  55. data/lib/mindee/parsing/standard/classification_field.rb +16 -0
  56. data/lib/mindee/parsing/standard/company_registration_field.rb +21 -0
  57. data/lib/mindee/parsing/standard/date_field.rb +34 -0
  58. data/lib/mindee/parsing/standard/locale_field.rb +50 -0
  59. data/lib/mindee/parsing/standard/payment_details_field.rb +42 -0
  60. data/lib/mindee/parsing/standard/position_field.rb +44 -0
  61. data/lib/mindee/parsing/standard/tax_field.rb +108 -0
  62. data/lib/mindee/parsing/standard/text_field.rb +16 -0
  63. data/lib/mindee/parsing/standard.rb +12 -0
  64. data/lib/mindee/parsing.rb +3 -2
  65. data/lib/mindee/{input → pdf}/pdf_processing.rb +4 -32
  66. data/lib/mindee/pdf/pdf_tools.rb +34 -0
  67. data/lib/mindee/pdf.rb +3 -0
  68. data/lib/mindee/product/.rubocop.yml +5 -0
  69. data/lib/mindee/product/custom/custom_v1.rb +35 -0
  70. data/lib/mindee/product/custom/custom_v1_document.rb +60 -0
  71. data/lib/mindee/product/custom/custom_v1_page.rb +32 -0
  72. data/lib/mindee/product/eu/license_plate/license_plate_v1.rb +38 -0
  73. data/lib/mindee/product/eu/license_plate/license_plate_v1_document.rb +37 -0
  74. data/lib/mindee/product/eu/license_plate/license_plate_v1_page.rb +34 -0
  75. data/lib/mindee/product/financial_document/financial_document_v1.rb +36 -0
  76. data/lib/mindee/product/financial_document/financial_document_v1_document.rb +188 -0
  77. data/lib/mindee/product/financial_document/financial_document_v1_line_item.rb +90 -0
  78. data/lib/mindee/product/financial_document/financial_document_v1_page.rb +32 -0
  79. data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1.rb +38 -0
  80. data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1_document.rb +43 -0
  81. data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1_page.rb +34 -0
  82. data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2.rb +38 -0
  83. data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_bban.rb +71 -0
  84. data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_document.rb +58 -0
  85. data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_page.rb +34 -0
  86. data/lib/mindee/product/fr/carte_vitale/carte_vitale_v1.rb +38 -0
  87. data/lib/mindee/product/fr/carte_vitale/carte_vitale_v1_document.rb +52 -0
  88. data/lib/mindee/product/fr/carte_vitale/carte_vitale_v1_page.rb +34 -0
  89. data/lib/mindee/product/fr/id_card/id_card_v1.rb +38 -0
  90. data/lib/mindee/product/fr/id_card/id_card_v1_document.rb +82 -0
  91. data/lib/mindee/product/fr/id_card/id_card_v1_page.rb +48 -0
  92. data/lib/mindee/product/invoice/invoice_v4.rb +37 -0
  93. data/lib/mindee/product/invoice/invoice_v4_document.rb +212 -0
  94. data/lib/mindee/product/invoice/invoice_v4_line_item.rb +66 -0
  95. data/lib/mindee/product/invoice/invoice_v4_page.rb +32 -0
  96. data/lib/mindee/product/invoice_splitter/invoice_splitter_v1.rb +36 -0
  97. data/lib/mindee/product/invoice_splitter/invoice_splitter_v1_document.rb +65 -0
  98. data/lib/mindee/product/invoice_splitter/invoice_splitter_v1_page.rb +32 -0
  99. data/lib/mindee/product/passport/passport_v1.rb +36 -0
  100. data/lib/mindee/{parsing/prediction/fr/id_card/id_card_v1.rb → product/passport/passport_v1_document.rb} +45 -45
  101. data/lib/mindee/product/passport/passport_v1_page.rb +32 -0
  102. data/lib/mindee/product/proof_of_address/proof_of_address_v1.rb +36 -0
  103. data/lib/mindee/product/proof_of_address/proof_of_address_v1_document.rb +83 -0
  104. data/lib/mindee/product/proof_of_address/proof_of_address_v1_page.rb +32 -0
  105. data/lib/mindee/product/receipt/receipt_v4.rb +36 -0
  106. data/lib/mindee/product/receipt/receipt_v4_document.rb +86 -0
  107. data/lib/mindee/product/receipt/receipt_v4_page.rb +32 -0
  108. data/lib/mindee/product/receipt/receipt_v5.rb +36 -0
  109. data/lib/mindee/product/receipt/receipt_v5_document.rb +138 -0
  110. data/lib/mindee/product/receipt/receipt_v5_line_item.rb +69 -0
  111. data/lib/mindee/product/receipt/receipt_v5_page.rb +32 -0
  112. data/lib/mindee/product/us/bank_check/bank_check_v1.rb +38 -0
  113. data/lib/mindee/product/us/bank_check/bank_check_v1_document.rb +73 -0
  114. data/lib/mindee/product/us/bank_check/bank_check_v1_page.rb +34 -0
  115. data/lib/mindee/product.rb +16 -0
  116. data/lib/mindee/version.rb +2 -1
  117. data/lib/mindee.rb +3 -1
  118. metadata +87 -38
  119. data/docs/code_samples/shipping_containers_v1.txt +0 -14
  120. data/lib/mindee/document_config.rb +0 -60
  121. data/lib/mindee/parsing/document.rb +0 -31
  122. data/lib/mindee/parsing/error.rb +0 -22
  123. data/lib/mindee/parsing/inference.rb +0 -53
  124. data/lib/mindee/parsing/page.rb +0 -46
  125. data/lib/mindee/parsing/prediction/base.rb +0 -30
  126. data/lib/mindee/parsing/prediction/common_fields/amount.rb +0 -21
  127. data/lib/mindee/parsing/prediction/common_fields/base.rb +0 -72
  128. data/lib/mindee/parsing/prediction/common_fields/company_registration.rb +0 -17
  129. data/lib/mindee/parsing/prediction/common_fields/date.rb +0 -30
  130. data/lib/mindee/parsing/prediction/common_fields/locale.rb +0 -45
  131. data/lib/mindee/parsing/prediction/common_fields/payment_details.rb +0 -33
  132. data/lib/mindee/parsing/prediction/common_fields/position.rb +0 -39
  133. data/lib/mindee/parsing/prediction/common_fields/tax.rb +0 -40
  134. data/lib/mindee/parsing/prediction/common_fields/text.rb +0 -12
  135. data/lib/mindee/parsing/prediction/common_fields.rb +0 -11
  136. data/lib/mindee/parsing/prediction/custom/custom_v1.rb +0 -58
  137. data/lib/mindee/parsing/prediction/custom/fields.rb +0 -91
  138. data/lib/mindee/parsing/prediction/eu/license_plate/license_plate_v1.rb +0 -34
  139. data/lib/mindee/parsing/prediction/financial_document/financial_document_v1.rb +0 -237
  140. data/lib/mindee/parsing/prediction/financial_document/financial_document_v1_line_item.rb +0 -58
  141. data/lib/mindee/parsing/prediction/fr/bank_account_details/bank_account_details_v1.rb +0 -40
  142. data/lib/mindee/parsing/prediction/fr/carte_vitale/carte_vitale_v1.rb +0 -49
  143. data/lib/mindee/parsing/prediction/invoice/invoice_v4.rb +0 -212
  144. data/lib/mindee/parsing/prediction/invoice/invoice_v4_line_item.rb +0 -58
  145. data/lib/mindee/parsing/prediction/passport/passport_v1.rb +0 -121
  146. data/lib/mindee/parsing/prediction/proof_of_address/proof_of_address_v1.rb +0 -80
  147. data/lib/mindee/parsing/prediction/receipt/receipt_v4.rb +0 -87
  148. data/lib/mindee/parsing/prediction/receipt/receipt_v5.rb +0 -136
  149. data/lib/mindee/parsing/prediction/receipt/receipt_v5_line_item.rb +0 -37
  150. data/lib/mindee/parsing/prediction/shipping_container/shipping_container_v1.rb +0 -38
  151. data/lib/mindee/parsing/prediction/us/bank_check/bank_check_v1.rb +0 -70
  152. data/lib/mindee/parsing/prediction.rb +0 -15
@@ -1,4 +1,4 @@
1
- The Ruby OCR SDK supports the [passport API](https://developers.mindee.com/docs/passport-ocr) for extracting data from passports.
1
+ The Ruby OCR SDK supports the [passport API](https://developers.mindee.com/docs/passport-ocr) for extracting data from passports.
2
2
 
3
3
  Using the sample below, we are going to illustrate how to extract the data that we want using the OCR SDK.
4
4
 
@@ -6,31 +6,38 @@ Using the sample below, we are going to illustrate how to extract the data that
6
6
 
7
7
  ## Quick Start
8
8
  ```ruby
9
- require 'mindee'
10
-
11
- # Init a new client, specifying an API key
9
+ # Init a new client
12
10
  mindee_client = Mindee::Client.new(api_key: 'my-api-key')
13
11
 
14
- # Send the file
15
- result = mindee_client.doc_from_path('/path/to/the/file.ext').parse(Mindee::Prediction::PassportV1)
12
+ # Load a file from disk
13
+ input_source = mindee_client.source_from_path('/path/to/the/file.ext')
14
+
15
+ # Parse the file
16
+ result = mindee_client.parse(
17
+ input_source,
18
+ Mindee::Product::Passport::PassportV1
19
+ )
16
20
 
17
- # Print a summary of the document prediction in RST format
18
- puts result.inference.prediction
21
+ # Print a full summary of the parsed data in RST format
22
+ puts result.document
19
23
  ```
20
24
 
21
25
  Output:
22
26
  ```
23
- :Full name: HENERT PUDARSAN
24
- :Given names: HENERT
25
- :Surname: PUDARSAN
26
- :Country: GBR
27
- :ID Number: 707797979
28
- :Issuance date: 2012-04-22
29
- :Birth date: 1995-05-20
30
- :Expiry date: 2017-04-22
31
- :MRZ 1: P<GBRPUDARSAN<<HENERT<<<<<<<<<<<<<<<<<<<<<<<
32
- :MRZ 2: 7077979792GBR9505209M1704224<<<<<<<<<<<<<<00
33
- :MRZ: P<GBRPUDARSAN<<HENERT<<<<<<<<<<<<<<<<<<<<<<<7077979792GBR9505209M1704224<<<<<<<<<<<<<<00
27
+ ----- Passport V1 -----
28
+ Filename:
29
+ Full name: HENERT PUDARSAN
30
+ Given names: HENERT
31
+ Surname: PUDARSAN
32
+ Country: GBR
33
+ ID Number: 707797979
34
+ Issuance date: 2012-04-22
35
+ Birth date: 1995-05-20
36
+ Expiry date: 2057-04-22
37
+ MRZ 1: P<GBRPUDARSAN<<HENERT<<<<<<<<<<<<<<<<<<<<<<<
38
+ MRZ 2: 7077979792GBR9505209M1704224<<<<<<<<<<<<<<00
39
+ MRZ: P<GBRPUDARSAN<<HENERT<<<<<<<<<<<<<<<<<<<<<<<7077979792GBR9505209M1704224<<<<<<<<<<<<<<00
40
+ ----------------------
34
41
  ```
35
42
 
36
43
  ## Fields
@@ -49,29 +56,31 @@ Depending on the field type specified, additional attributes can be extracted fr
49
56
 
50
57
  Using the above sample, the following are the basic fields that can be extracted:
51
58
 
52
- - [Orientation](#orientation)
53
- - [Birth Place](#birth-place)
54
- - [Country](#country)
55
- - [Dates (Expiry, Issuance, Birth)](#dates)
56
- - [Gender](#gender)
57
- - [Given Names](#given-names)
58
- - [ID Number](#id)
59
- - [Machine Readable Zone](#machine-readable-zone)
60
- - [Surname](#surname)
59
+ - [Quick Start](#quick-start)
60
+ - [Fields](#fields)
61
+ - [Attributes](#attributes)
62
+ - [Birth Place](#birth-place)
63
+ - [Country](#country)
64
+ - [Dates](#dates)
65
+ - [Gender](#gender)
66
+ - [Names](#names)
67
+ - [ID](#id)
68
+ - [Machine-Readable Zone](#machine-readable-zone)
69
+ - [Questions?](#questions)
61
70
 
62
71
  ### Birth Place
63
72
 
64
73
  **`birth_place`** (Field): Passport owner birthplace.
65
74
 
66
75
  ```ruby
67
- puts result.inference.prediction.birth_place.value
76
+ puts result.document.inference.prediction.birth_place.value
68
77
  ```
69
78
 
70
79
  ### Country
71
80
  **`country`** (Field): Passport country in [ISO 3166-1 alpha-3 code format](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) (3-letter code).
72
81
 
73
82
  ```ruby
74
- puts result.inference.prediction.country.value
83
+ puts result.document.inference.prediction.country.value
75
84
  ```
76
85
 
77
86
  ### Dates
@@ -85,19 +94,19 @@ The following date fields are available:
85
94
  **`expiry_date`**: Passport expiry date.
86
95
 
87
96
  ```ruby
88
- puts result.inference.prediction.expiry_date.value
97
+ puts result.document.inference.prediction.expiry_date.value
89
98
  ```
90
99
 
91
100
  **`issuance_date`**: Passport date of issuance.
92
101
 
93
102
  ```ruby
94
- puts result.inference.prediction.issuance_date.value
103
+ puts result.document.inference.prediction.issuance_date.value
95
104
  ```
96
105
 
97
106
  **`birth_date`**: Passport's owner date of birth.
98
107
 
99
108
  ```ruby
100
- puts result.inference.prediction.birth_date.value
109
+ puts result.document.inference.prediction.birth_date.value
101
110
  ```
102
111
 
103
112
  ### Gender
@@ -105,7 +114,7 @@ puts result.inference.prediction.birth_date.value
105
114
  **`gender`** (Field): Passport owner's gender (M / F).
106
115
 
107
116
  ```ruby
108
- puts result.inference.prediction.gender.value
117
+ puts result.document.inference.prediction.gender.value
109
118
  ```
110
119
 
111
120
  ### Names
@@ -113,7 +122,7 @@ puts result.inference.prediction.gender.value
113
122
  **`given_names`** (Array< Field >): List of passport owner's given names.
114
123
 
115
124
  ```ruby
116
- result.inference.prediction.given_names.each do |name|
125
+ result.document.inference.prediction.given_names.each do |name|
117
126
  puts name
118
127
  end
119
128
  ```
@@ -121,7 +130,7 @@ end
121
130
  **`surname`** (Field): Passport's owner surname.
122
131
 
123
132
  ```ruby
124
- puts result.inference.prediction.surname.value
133
+ puts result.document.inference.prediction.surname.value
125
134
  ```
126
135
 
127
136
  ### ID
@@ -129,7 +138,7 @@ puts result.inference.prediction.surname.value
129
138
  **`id_number`** (Field): Passport identification number.
130
139
 
131
140
  ```ruby
132
- puts result.inference.prediction.id_number.value
141
+ puts result.document.inference.prediction.id_number.value
133
142
  ```
134
143
 
135
144
  ### Machine-Readable Zone
@@ -137,19 +146,19 @@ puts result.inference.prediction.id_number.value
137
146
  **`mrz1`** (Field): Passport first line of machine-readable zone.
138
147
 
139
148
  ```ruby
140
- puts result.inference.prediction.mrz1.value
149
+ puts result.document.inference.prediction.mrz1.value
141
150
  ```
142
151
 
143
152
  **`mrz2`** (Field): Passport second line of machine-readable zone.
144
153
 
145
154
  ```ruby
146
- puts result.inference.prediction.mrz2.value
155
+ puts result.document.inference.prediction.mrz2.value
147
156
  ```
148
157
 
149
158
  **`mrz`** (Field): Reconstructed passport full machine-readable zone from mrz1 and mrz2.
150
159
 
151
160
  ```ruby
152
- puts result.inference.prediction.mrz.value
161
+ puts result.document.inference.prediction.mrz.value
153
162
  ```
154
163
 
155
164
  ## Questions?
@@ -8,22 +8,27 @@ Using this sample below, we are going to illustrate how to extract the data that
8
8
  ```ruby
9
9
  require 'mindee'
10
10
 
11
- # Init a new client, specifying an API key
11
+ # Init a new client
12
12
  mindee_client = Mindee::Client.new(api_key: 'my-api-key')
13
13
 
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)
14
+ # Load a file from disk
15
+ input_source = mindee_client.source_from_path('/path/to/the/file.ext')
17
16
 
18
- # Print a full summary of the parsed data in RST format
19
- # puts result
17
+ # Parse the file
18
+ result = mindee_client.parse(
19
+ input_source,
20
+ Mindee::Product::Receipt::ReceiptV5
21
+ )
20
22
 
21
- # Print the document-level parsed data
22
- puts result.inference.prediction
23
+ # Print a full summary of the parsed data in RST format
24
+ puts result.document
23
25
  ```
24
26
 
25
27
  Output:
26
28
  ```
29
+ Receipt V5 Prediction
30
+ =====================
31
+ :Filename:
27
32
  :Expense Locale: en-GB; en; GB; GBP;
28
33
  :Expense Category: food
29
34
  :Expense Sub Category: restaurant
@@ -34,17 +39,21 @@ Output:
34
39
  :Total Excluding Taxes: 8.50
35
40
  :Total Tax: 1.70
36
41
  :Tip and Gratuity:
37
- :Taxes: 1.70 20.00% VAT
42
+ :Taxes:
43
+ +---------------+--------+----------+---------------+
44
+ | Base | Code | Rate (%) | Amount |
45
+ +===============+========+==========+===============+
46
+ | 8.50 | VAT | 20.00 | 1.70 |
47
+ +---------------+--------+----------+---------------+
38
48
  :Supplier Name: CLACHAN
39
49
  :Supplier Company Registrations: 232153895
40
- 232153895
41
50
  :Supplier Address: 34 kingley street w1b 5qh
42
51
  :Supplier Phone Number: 02074940834
43
52
  :Line Items:
44
53
  +--------------------------------------+----------+--------------+------------+
45
54
  | Description | Quantity | Total Amount | Unit Price |
46
55
  +======================================+==========+==============+============+
47
- | Meantime Pale | 2.00 | 10.20 | |
56
+ | meantime pale | 2.00 | 10.20 | |
48
57
  +--------------------------------------+----------+--------------+------------+
49
58
  ```
50
59
 
@@ -64,13 +73,17 @@ Depending on the field type specified, additional attributes can be extracted in
64
73
 
65
74
  Using the above sample, the following are the basic fields that can be extracted:
66
75
 
67
- - [Category](#category)
68
- - [Date](#date)
69
- - [Locale](#locale)
70
- - [Supplier Information](#supplier-information)
71
- - [Taxes](#taxes)
72
- - [Time](#time)
73
- - [Totals](#totals)
76
+ - [Quick Start](#quick-start)
77
+ - [Fields](#fields)
78
+ - [Attributes](#attributes)
79
+ - [Category](#category)
80
+ - [Date](#date)
81
+ - [Locale](#locale)
82
+ - [Supplier Information](#supplier-information)
83
+ - [Taxes](#taxes)
84
+ - [Time](#time)
85
+ - [Totals](#totals)
86
+ - [Questions?](#questions)
74
87
 
75
88
 
76
89
  ### Category
@@ -78,7 +91,7 @@ Using the above sample, the following are the basic fields that can be extracted
78
91
  The following categories are supported: toll, food, parking, transport, accommodation, gasoline, miscellaneous.
79
92
 
80
93
  ```ruby
81
- puts result.inference.prediction.category.value
94
+ puts result.document.inference.prediction.category.value
82
95
  ```
83
96
 
84
97
 
@@ -93,7 +106,7 @@ The following date fields are available:
93
106
  * **`date`**: Date the receipt was issued
94
107
 
95
108
  ```ruby
96
- puts result.inference.prediction.date.value
109
+ puts result.document.inference.prediction.date.value
97
110
  ```
98
111
 
99
112
 
@@ -102,32 +115,32 @@ puts result.inference.prediction.date.value
102
115
 
103
116
  * `locale.value` (String): Locale with country and language codes.
104
117
  ```ruby
105
- puts result.inference.prediction.locale
118
+ puts result.document.inference.prediction.locale
106
119
  ```
107
120
 
108
121
  * `locale.language` (String): Language code in [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format as seen on the document.
109
122
  *
110
123
  ```ruby
111
- puts result.inference.prediction.locale.language
124
+ puts result.document.inference.prediction.locale.language
112
125
  ```
113
126
 
114
127
  * `locale.currency` (String): Currency code in [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format as seen on the document.
115
128
 
116
129
  ```ruby
117
- puts result.inference.prediction.locale.currency
130
+ puts result.document.inference.prediction.locale.currency
118
131
  ```
119
132
 
120
133
  * `locale.country` (String): Country code in [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) alpha-2 format as seen on the document.
121
134
 
122
135
  ```ruby
123
- puts result.inference.prediction.locale.country
136
+ puts result.document.inference.prediction.locale.country
124
137
  ```
125
138
 
126
139
  ### Supplier Information
127
140
  * **`supplier_name`** (Field): Supplier name as written in the receipt.
128
141
 
129
142
  ```ruby
130
- puts result.inference.prediction.supplier_name.value
143
+ puts result.document.inference.prediction.supplier_name.value
131
144
  ```
132
145
 
133
146
 
@@ -137,19 +150,19 @@ puts result.inference.prediction.supplier_name.value
137
150
  * `value` (Float): The tax amount.
138
151
  ```ruby
139
152
  # Show the amount of the first tax
140
- puts result.inference.prediction.taxes[0].value
153
+ puts result.document.inference.prediction.taxes[0].value
141
154
  ```
142
155
 
143
156
  * `code` (String): The tax code (HST, GST... for Canadian; City Tax, State tax for US, etc..).
144
157
  ```ruby
145
158
  # Show the code of the first tax
146
- puts result.inference.prediction.taxes[0].code
159
+ puts result.document.inference.prediction.taxes[0].code
147
160
  ```
148
161
 
149
162
  * `rate` (Float): The tax rate.
150
163
  ```ruby
151
164
  # Show the rate of the first tax
152
- puts result.inference.prediction.taxes[0].rate
165
+ puts result.document.inference.prediction.taxes[0].rate
153
166
  ```
154
167
 
155
168
  ### Time
@@ -157,26 +170,26 @@ puts result.inference.prediction.taxes[0].rate
157
170
  * `value` (string): Time of purchase with 24 hours formatting (hh:mm).
158
171
 
159
172
  ```ruby
160
- puts result.inference.prediction.time.value
173
+ puts result.document.inference.prediction.time.value
161
174
  ```
162
175
 
163
176
  ### Totals
164
177
  * **`total_amount`** (Field): Total amount including taxes
165
178
 
166
179
  ```ruby
167
- puts result.inference.prediction.total_amount.value
180
+ puts result.document.inference.prediction.total_amount.value
168
181
  ```
169
182
 
170
183
  * **`total_net`** (Field): Total amount paid excluding taxes
171
184
 
172
185
  ```ruby
173
- puts result.inference.prediction.total_net.value
186
+ puts result.document.inference.prediction.total_net.value
174
187
  ```
175
188
 
176
189
  * **`total_tax`** (Field): Total tax value from tax lines
177
190
 
178
191
  ```ruby
179
- puts result.inference.prediction.total_tax.value
192
+ puts result.document.inference.prediction.total_tax.value
180
193
  ```
181
194
 
182
195
  ## Questions?