Skip to content

Commit 4d11d41

Browse files
📝 update documentation (#202)
1 parent a2414e7 commit 4d11d41

File tree

5 files changed

+106
-10
lines changed

5 files changed

+106
-10
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import com.mindee.MindeeClient;
2+
import com.mindee.input.LocalInputSource;
3+
import com.mindee.parsing.common.AsyncPredictResponse;
4+
import com.mindee.product.receipt.ReceiptV5;
5+
import java.io.File;
6+
import java.io.IOException;
7+
8+
public class SimpleMindeeClient {
9+
10+
public static void main(String[] args) throws IOException, InterruptedException {
11+
String apiKey = "my-api-key";
12+
String filePath = "/path/to/the/file.ext";
13+
14+
// Init a new client
15+
MindeeClient mindeeClient = new MindeeClient(apiKey);
16+
17+
// Load a file from disk
18+
LocalInputSource inputSource = new LocalInputSource(new File(filePath));
19+
20+
// Parse the file asynchronously
21+
AsyncPredictResponse<ReceiptV5> response = mindeeClient.enqueueAndParse(
22+
ReceiptV5.class,
23+
inputSource
24+
);
25+
26+
// Print a summary of the response
27+
System.out.println(response.toString());
28+
29+
// Print a summary of the predictions
30+
// System.out.println(response.getDocumentObj().toString());
31+
32+
// Print the document-level predictions
33+
// System.out.println(response.getDocumentObj().getInference().getPrediction().toString());
34+
35+
// Print the page-level predictions
36+
// response.getDocumentObj().getInference().getPages().forEach(
37+
// page -> System.out.println(page.toString())
38+
// );
39+
}
40+
41+
}

docs/energy_bill_fra_v1.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ parentDoc: 631a062c3718850f3519b793
66
---
77
The Java OCR SDK supports the [Energy Bill API](https://platform.mindee.com/mindee/energy_bill_fra).
88

9-
Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/energy_bill_fra/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK.
10-
![Energy Bill sample](https://github.com/mindee/client-lib-test-data/blob/main/products/energy_bill_fra/default_sample.jpg?raw=true)
9+
Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/energy_bill_fra/default_sample.pdf), we are going to illustrate how to extract the data that we want using the OCR SDK.
10+
![Energy Bill sample](https://github.com/mindee/client-lib-test-data/blob/main/products/energy_bill_fra/default_sample.pdf?raw=true)
1111

1212
# Quick-Start
1313
```java

docs/expense_receipts_v5.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,53 @@ public class SimpleMindeeClient {
5555

5656
```
5757

58+
You can also call this product asynchronously:
59+
60+
```java
61+
import com.mindee.MindeeClient;
62+
import com.mindee.input.LocalInputSource;
63+
import com.mindee.parsing.common.AsyncPredictResponse;
64+
import com.mindee.product.receipt.ReceiptV5;
65+
import java.io.File;
66+
import java.io.IOException;
67+
68+
public class SimpleMindeeClient {
69+
70+
public static void main(String[] args) throws IOException, InterruptedException {
71+
String apiKey = "my-api-key";
72+
String filePath = "/path/to/the/file.ext";
73+
74+
// Init a new client
75+
MindeeClient mindeeClient = new MindeeClient(apiKey);
76+
77+
// Load a file from disk
78+
LocalInputSource inputSource = new LocalInputSource(new File(filePath));
79+
80+
// Parse the file asynchronously
81+
AsyncPredictResponse<ReceiptV5> response = mindeeClient.enqueueAndParse(
82+
ReceiptV5.class,
83+
inputSource
84+
);
85+
86+
// Print a summary of the response
87+
System.out.println(response.toString());
88+
89+
// Print a summary of the predictions
90+
// System.out.println(response.getDocumentObj().toString());
91+
92+
// Print the document-level predictions
93+
// System.out.println(response.getDocumentObj().getInference().getPrediction().toString());
94+
95+
// Print the page-level predictions
96+
// response.getDocumentObj().getInference().getPages().forEach(
97+
// page -> System.out.println(page.toString())
98+
// );
99+
}
100+
101+
}
102+
103+
```
104+
58105
**Output (RST):**
59106
```rst
60107
########
@@ -72,7 +119,7 @@ Prediction
72119
==========
73120
:Expense Locale: en-GB; en; GB; GBP;
74121
:Purchase Category: food
75-
:Purchase Subcategory:
122+
:Purchase Subcategory: restaurant
76123
:Document Type: EXPENSE RECEIPT
77124
:Purchase Date: 2016-02-26
78125
:Purchase Time: 15:20
@@ -106,7 +153,7 @@ Page 0
106153
------
107154
:Expense Locale: en-GB; en; GB; GBP;
108155
:Purchase Category: food
109-
:Purchase Subcategory:
156+
:Purchase Subcategory: restaurant
110157
:Document Type: EXPENSE RECEIPT
111158
:Purchase Date: 2016-02-26
112159
:Purchase Time: 15:20

docs/financial_document_v1.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,23 +107,25 @@ public class SimpleMindeeClient {
107107
########
108108
Document
109109
########
110-
:Mindee ID: 3859a462-e05f-4f4c-a736-febca66b9aa9
110+
:Mindee ID: 340ee4ae-b4da-41f0-b5ea-81ae29852b57
111111
:Filename: default_sample.jpg
112112
113113
Inference
114114
#########
115-
:Product: mindee/financial_document v1.9
115+
:Product: mindee/financial_document v1.10
116116
:Rotation applied: Yes
117117
118118
Prediction
119119
==========
120120
:Locale: en; en; USD;
121121
:Invoice Number: INT-001
122+
:Purchase Order Number: 2412/2019
122123
:Receipt Number:
123124
:Document Number: INT-001
124125
:Reference Numbers: 2412/2019
125126
:Purchase Date: 2019-11-02
126127
:Due Date: 2019-02-26
128+
:Payment Date: 2019-02-26
127129
:Total Net: 195.00
128130
:Total Amount: 204.75
129131
:Taxes:
@@ -169,11 +171,13 @@ Page 0
169171
------
170172
:Locale: en; en; USD;
171173
:Invoice Number: INT-001
174+
:Purchase Order Number: 2412/2019
172175
:Receipt Number:
173176
:Document Number: INT-001
174177
:Reference Numbers: 2412/2019
175178
:Purchase Date: 2019-11-02
176179
:Due Date: 2019-02-26
180+
:Payment Date: 2019-02-26
177181
:Total Net: 195.00
178182
:Total Amount: 204.75
179183
:Taxes:

docs/invoices_v4.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,21 +107,23 @@ public class SimpleMindeeClient {
107107
########
108108
Document
109109
########
110-
:Mindee ID: 372d9d08-59d8-4e1c-9622-06648c1c238b
110+
:Mindee ID: 651b6417-bc50-496e-aa81-207219f0b9f4
111111
:Filename: default_sample.jpg
112112
113113
Inference
114114
#########
115-
:Product: mindee/invoices v4.7
115+
:Product: mindee/invoices v4.8
116116
:Rotation applied: Yes
117117
118118
Prediction
119119
==========
120120
:Locale: en; en; CAD;
121121
:Invoice Number: 14
122+
:Purchase Order Number: AD29094
122123
:Reference Numbers: AD29094
123124
:Purchase Date: 2018-09-25
124125
:Due Date:
126+
:Payment Date:
125127
:Total Net: 2145.00
126128
:Total Amount: 2608.20
127129
:Total Tax: 193.20
@@ -137,7 +139,7 @@ Prediction
137139
:Supplier Address: 156 University Ave, Toronto ON, Canada, M5H 2H7
138140
:Supplier Phone Number: 4165551212
139141
:Supplier Website:
140-
:Supplier Email: ldoi@example.com
142+
:Supplier Email: j_coi@example.com
141143
:Customer Name: JIRO DOI
142144
:Customer Company Registrations:
143145
:Customer Address: 1954 Bloor Street West Toronto, ON, M6P 3K9 Canada
@@ -163,9 +165,11 @@ Page 0
163165
------
164166
:Locale: en; en; CAD;
165167
:Invoice Number: 14
168+
:Purchase Order Number: AD29094
166169
:Reference Numbers: AD29094
167170
:Purchase Date: 2018-09-25
168171
:Due Date:
172+
:Payment Date:
169173
:Total Net: 2145.00
170174
:Total Amount: 2608.20
171175
:Total Tax: 193.20
@@ -181,7 +185,7 @@ Page 0
181185
:Supplier Address: 156 University Ave, Toronto ON, Canada, M5H 2H7
182186
:Supplier Phone Number: 4165551212
183187
:Supplier Website:
184-
:Supplier Email: ldoi@example.com
188+
:Supplier Email: j_coi@example.com
185189
:Customer Name: JIRO DOI
186190
:Customer Company Registrations:
187191
:Customer Address: 1954 Bloor Street West Toronto, ON, M6P 3K9 Canada

0 commit comments

Comments
 (0)