Skip to content

Commit 6d96faa

Browse files
♻️ Update extra files (#304)
+ ⚰️ deprecate petrol receipt
1 parent 0c10fc4 commit 6d96faa

File tree

31 files changed

+590
-505
lines changed

31 files changed

+590
-505
lines changed

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,13 @@ Complete details on the working of the library are available in the following gu
194194
* [Python Financial Document OCR](https://developers.mindee.com/docs/python-financial-document-ocr)
195195
* [Python Passport OCR](https://developers.mindee.com/docs/python-passport-ocr)
196196
* [Python Proof of Address OCR](https://developers.mindee.com/docs/python-proof-of-address-ocr)
197-
* [Python EU License Plate OCR](https://developers.mindee.com/docs/python-eu-license-plate-ocr)
198197
* [Python US Driver License OCR](https://developers.mindee.com/docs/python-eu-driver-license-ocr)
199198
* [Python FR Bank Account Detail OCR](https://developers.mindee.com/docs/python-fr-bank-account-details-ocr)
200199
* [Python FR Carte Grise OCR](https://developers.mindee.com/docs/python-fr-carte-grise-ocr)
201200
* [Python FR Health Card OCR](https://developers.mindee.com/docs/python-fr-health-card-ocr)
202201
* [Python FR ID Card OCR](https://developers.mindee.com/docs/python-fr-carte-nationale-didentite-ocr)
203-
* [Python FR Petrol Receipts OCR](https://developers.mindee.com/docs/python-fr-petrol-receipts-ocr)
204202
* [Python US Bank Check OCR](https://developers.mindee.com/docs/python-us-bank-check-ocr)
205203
* [Python US W9 OCR](https://developers.mindee.com/docs/python-us-w9-ocr)
206-
* [Python US Driver License OCR](https://developers.mindee.com/docs/python-us-driver-license-ocr)
207204
* [Python Barcode Reader API](https://developers.mindee.com/docs/python-barcode-reader-ocr)
208205
* [Python Cropper API](https://developers.mindee.com/docs/python-cropper-ocr)
209206
* [Python Invoice Splitter API](https://developers.mindee.com/docs/python-invoice-splitter-api)

docs/extras/code_samples/petrol_receipts_v1.txt

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
---
2+
title: Proof of Address OCR Python
3+
category: 622b805aaec68102ea7fcbc2
4+
slug: python-proof-of-address-ocr
5+
parentDoc: 609808f773b0b90051d839de
6+
---
7+
The Python OCR SDK supports the [Proof of Address API](https://platform.mindee.com/mindee/proof_of_address).
8+
9+
Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/proof_of_address/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK.
10+
![Proof of Address sample](https://github.com/mindee/client-lib-test-data/blob/main/products/proof_of_address/default_sample.jpg?raw=true)
11+
12+
# Quick-Start
13+
```py
14+
from mindee import Client, PredictResponse, product
15+
16+
# Init a new client
17+
mindee_client = Client(api_key="my-api-key")
18+
19+
# Load a file from disk
20+
input_doc = mindee_client.source_from_path("/path/to/the/file.ext")
21+
22+
# Load a file from disk and parse it.
23+
# The endpoint name must be specified since it cannot be determined from the class.
24+
result: PredictResponse = mindee_client.parse(product.ProofOfAddressV1, input_doc)
25+
26+
# Print a summary of the API result
27+
print(result.document)
28+
29+
# Print the document-level summary
30+
# print(result.document.inference.prediction)
31+
32+
```
33+
34+
**Output (RST):**
35+
```rst
36+
########
37+
Document
38+
########
39+
:Mindee ID: 5d2361e9-405e-4fc1-8531-f92a3aef0c38
40+
:Filename: default_sample.jpg
41+
42+
Inference
43+
#########
44+
:Product: mindee/proof_of_address v1.1
45+
:Rotation applied: Yes
46+
47+
Prediction
48+
==========
49+
:Locale: en; en; USD;
50+
:Issuer Name: PPL ELECTRIC UTILITIES
51+
:Issuer Company Registrations:
52+
:Issuer Address: 2 NORTH 9TH STREET CPC-GENN1 ALLENTOWN.PA 18101-1175
53+
:Recipient Name:
54+
:Recipient Company Registrations:
55+
:Recipient Address: 123 MAIN ST ANYTOWN,PA 18062
56+
:Dates: 2011-07-27
57+
2011-07-06
58+
2011-08-03
59+
2011-07-27
60+
2011-06-01
61+
2011-07-01
62+
2010-07-01
63+
2010-08-01
64+
2011-07-01
65+
2009-08-01
66+
2010-07-01
67+
2011-07-27
68+
:Date of Issue: 2011-07-27
69+
70+
Page Predictions
71+
================
72+
73+
Page 0
74+
------
75+
:Locale: en; en; USD;
76+
:Issuer Name: PPL ELECTRIC UTILITIES
77+
:Issuer Company Registrations:
78+
:Issuer Address: 2 NORTH 9TH STREET CPC-GENN1 ALLENTOWN.PA 18101-1175
79+
:Recipient Name:
80+
:Recipient Company Registrations:
81+
:Recipient Address: 123 MAIN ST ANYTOWN,PA 18062
82+
:Dates: 2011-07-27
83+
2011-07-06
84+
2011-08-03
85+
2011-07-27
86+
2011-06-01
87+
2011-07-01
88+
2010-07-01
89+
2010-08-01
90+
2011-07-01
91+
2009-08-01
92+
2010-07-01
93+
2011-07-27
94+
:Date of Issue: 2011-07-27
95+
```
96+
97+
# Field Types
98+
## Standard Fields
99+
These fields are generic and used in several products.
100+
101+
### BaseField
102+
Each prediction object contains a set of fields that inherit from the generic `BaseField` class.
103+
A typical `BaseField` object will have the following attributes:
104+
105+
* **value** (`Union[float, str]`): corresponds to the field value. Can be `None` if no value was extracted.
106+
* **confidence** (`float`): the confidence score of the field prediction.
107+
* **bounding_box** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
108+
* **polygon** (`List[Point]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
109+
* **page_id** (`int`): the ID of the page, always `None` when at document-level.
110+
* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it).
111+
112+
> **Note:** A `Point` simply refers to a List of two numbers (`[float, float]`).
113+
114+
115+
Aside from the previous attributes, all basic fields have access to a custom `__str__` method that can be used to print their value as a string.
116+
117+
118+
### CompanyRegistrationField
119+
Aside from the basic `BaseField` attributes, the company registration field `CompanyRegistrationField` also implements the following:
120+
121+
* **type** (`str`): the type of company.
122+
123+
### DateField
124+
Aside from the basic `BaseField` attributes, the date field `DateField` also implements the following:
125+
126+
* **date_object** (`Date`): an accessible representation of the value as a python object. Can be `None`.
127+
128+
### LocaleField
129+
The locale field `LocaleField` only implements the **value**, **confidence** and **page_id** base `BaseField` attributes, but it comes with its own:
130+
131+
* **language** (`str`): ISO 639-1 language code (e.g.: `en` for English). Can be `None`.
132+
* **country** (`str`): ISO 3166-1 alpha-2 or ISO 3166-1 alpha-3 code for countries (e.g.: `GRB` or `GB` for "Great Britain"). Can be `None`.
133+
* **currency** (`str`): ISO 4217 code for currencies (e.g.: `USD` for "US Dollars"). Can be `None`.
134+
135+
### StringField
136+
The text field `StringField` only has one constraint: its **value** is an `Optional[str]`.
137+
138+
# Attributes
139+
The following fields are extracted for Proof of Address V1:
140+
141+
## Date of Issue
142+
**date** ([DateField](#datefield)): The date the document was issued.
143+
144+
```py
145+
print(result.document.inference.prediction.date.value)
146+
```
147+
148+
## Dates
149+
**dates** (List[[DateField](#datefield)]): List of dates found on the document.
150+
151+
```py
152+
for dates_elem in result.document.inference.prediction.dates:
153+
print(dates_elem.value)
154+
```
155+
156+
## Issuer Address
157+
**issuer_address** ([StringField](#stringfield)): The address of the document's issuer.
158+
159+
```py
160+
print(result.document.inference.prediction.issuer_address.value)
161+
```
162+
163+
## Issuer Company Registrations
164+
**issuer_company_registration** (List[[CompanyRegistrationField](#companyregistrationfield)]): List of company registrations found for the issuer.
165+
166+
```py
167+
for issuer_company_registration_elem in result.document.inference.prediction.issuer_company_registration:
168+
print(issuer_company_registration_elem.value)
169+
```
170+
171+
## Issuer Name
172+
**issuer_name** ([StringField](#stringfield)): The name of the person or company issuing the document.
173+
174+
```py
175+
print(result.document.inference.prediction.issuer_name.value)
176+
```
177+
178+
## Locale
179+
**locale** ([LocaleField](#localefield)): The locale detected on the document.
180+
181+
```py
182+
print(result.document.inference.prediction.locale.value)
183+
```
184+
185+
## Recipient Address
186+
**recipient_address** ([StringField](#stringfield)): The address of the recipient.
187+
188+
```py
189+
print(result.document.inference.prediction.recipient_address.value)
190+
```
191+
192+
## Recipient Company Registrations
193+
**recipient_company_registration** (List[[CompanyRegistrationField](#companyregistrationfield)]): List of company registrations found for the recipient.
194+
195+
```py
196+
for recipient_company_registration_elem in result.document.inference.prediction.recipient_company_registration:
197+
print(recipient_company_registration_elem.value)
198+
```
199+
200+
## Recipient Name
201+
**recipient_name** ([StringField](#stringfield)): The name of the person or company receiving the document.
202+
203+
```py
204+
print(result.document.inference.prediction.recipient_name.value)
205+
```
206+
207+
# Questions?
208+
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)

docs/product/fr/petrol_receipt_v1.rst

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)