You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Python OCR SDK supports the [Invoice Splitter API](https://platform.mindee.com/mindee/invoice_splitter).
8
8
9
-
Using [this sample](https://github.com/mindee/client-lib-test-data/blob/main/products/invoice_splitter/default_sample.pdf), we are going to illustrate how to detect the pages of multiple invoices within the same document.
9
+
Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/invoice_splitter/default_sample.pdf), we are going to illustrate how to extract the data that we want using the OCR SDK.
These fields are generic and used in several products.
69
67
70
-
## Specific Fields
68
+
### BaseField
69
+
Each prediction object contains a set of fields that inherit from the generic `BaseField` class.
70
+
A typical `BaseField` object will have the following attributes:
71
71
72
-
### Page Group
72
+
***value** (`Union[float, str]`): corresponds to the field value. Can be `None` if no value was extracted.
73
+
***confidence** (`float`): the confidence score of the field prediction.
74
+
***bounding_box** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
75
+
***polygon** (`List[Point]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
76
+
***page_id** (`int`): the ID of the page, always `None` when at document-level.
77
+
***reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it).
73
78
74
-
List of page group indexes.
79
+
> **Note:** A `Point` simply refers to a List of two numbers (`[float, float]`).
75
80
76
-
An `InvoiceSplitterV1PageGroup` implements the following attributes:
77
81
78
-
-**page_indexes** (`float`\[]): List of indexes of the pages of a single invoice.
79
-
-**confidence** (`float`): The confidence of the prediction.
82
+
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.
80
83
81
-
# Attributes
84
+
## Specific Fields
85
+
Fields which are specific to this product; they are not used in any other product.
86
+
87
+
### Invoice Page Groups Field
88
+
List of page groups. Each group represents a single invoice within a multi-invoice document.
89
+
90
+
A `InvoiceSplitterV1InvoicePageGroup` implements the following attributes:
91
+
92
+
***page_indexes** (`List[int]`): List of page indexes that belong to the same invoice (group).
82
93
94
+
# Attributes
83
95
The following fields are extracted for Invoice Splitter V1:
84
96
85
97
## Invoice Page Groups
86
-
87
-
**invoice_page_groups** ([InvoiceSplitterV1PageGroup](#invoice-splitter-v1-page-group)\[]): List of page indexes that belong to the same invoice in the PDF.
98
+
**invoice_page_groups** (List[[InvoiceSplitterV1InvoicePageGroup](#invoice-page-groups-field)]): List of page groups. Each group represents a single invoice within a multi-invoice document.
88
99
89
100
```py
90
-
for invoice_page_groups_elem inpage.prediction.invoice_page_groups):
91
-
print(invoice_page_groups_elem)
101
+
for invoice_page_groups_elem inresult.document.inference.prediction.invoice_page_groups:
0 commit comments