US Mail V3
Sample Code:
from mindee import Client, product, AsyncPredictResponse
# Init a new client
mindee_client = Client(api_key="my-api-key")
# Load a file from disk
input_doc = mindee_client.source_from_path("/path/to/the/file.ext")
# Load a file from disk and enqueue it.
result: AsyncPredictResponse = mindee_client.enqueue_and_parse(
product.us.UsMailV3,
input_doc,
)
# Print a brief summary of the parsed data
print(result.document)
- class UsMailV3(raw_prediction)
US Mail API version 3 inference prediction.
- Parameters:
raw_prediction (Dict[str, Any]) –
- static get_endpoint_info(klass)
Retrives the endpoint information for an Inference.
Should never retrieve info for CustomV1, as a custom endpoint should be created to use CustomV1.
- Parameters:
klass (
Type
[Inference
]) – product subclass to access endpoint information.- Return type:
Dict
[str
,str
]
- endpoint_name: Optional[str] = 'us_mail'
Name of the endpoint.
- endpoint_version: Optional[str] = '3'
Version of the endpoint.
- is_rotation_applied: Optional[bool]
Whether the document has had any rotation applied to it.
- page_id: Optional[int]
Optional page id for page-level predictions.
-
pages:
List
[Page
[UsMailV3Document
]] Page-level prediction(s).
-
prediction:
UsMailV3Document
Document-level prediction.
- product: Product
Name and version of a given product, as sent back by the API.
- class UsMailV3Document(raw_prediction, page_id=None)
US Mail API version 3.0 document data.
- Parameters:
raw_prediction (Dict[str, Any]) –
page_id (Optional[int]) –
-
is_return_to_sender:
BooleanField
Whether the mailing is marked as return to sender.
-
recipient_addresses:
List
[UsMailV3RecipientAddress
] The addresses of the recipients.
-
recipient_names:
List
[StringField
] The names of the recipients.
-
sender_address:
UsMailV3SenderAddress
The address of the sender.
-
sender_name:
StringField
The name of the sender.
- class UsMailV3SenderAddress(raw_prediction, page_id=None)
The address of the sender.
- Parameters:
raw_prediction (Dict[str, Any]) –
page_id (Optional[int]) –
- to_field_list()
Output the object in a format suitable for inclusion in an rST field list.
- Return type:
str
- bounding_box: Optional[Quadrilateral]
A right rectangle containing the word in the document.
-
city:
Optional
[str
] The city of the sender’s address.
-
complete:
Optional
[str
] The complete address of the sender.
- confidence: float
The confidence score.
-
page_n:
int
The document page on which the information was found.
- polygon: Polygon
A polygon containing the word in the document.
-
postal_code:
Optional
[str
] The postal code of the sender’s address.
-
state:
Optional
[str
] Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.
-
street:
Optional
[str
] The street of the sender’s address.
- class UsMailV3RecipientAddress(raw_prediction, page_id=None)
The addresses of the recipients.
- Parameters:
raw_prediction (Dict[str, Any]) –
page_id (Optional[int]) –
- to_table_line()
Output in a format suitable for inclusion in an rST table.
- Return type:
str
- bounding_box: Optional[Quadrilateral]
A right rectangle containing the word in the document.
-
city:
Optional
[str
] The city of the recipient’s address.
-
complete:
Optional
[str
] The complete address of the recipient.
- confidence: float
The confidence score.
-
is_address_change:
Optional
[bool
] Indicates if the recipient’s address is a change of address.
-
page_n:
int
The document page on which the information was found.
- polygon: Polygon
A polygon containing the word in the document.
-
postal_code:
Optional
[str
] The postal code of the recipient’s address.
-
private_mailbox_number:
Optional
[str
] The private mailbox number of the recipient’s address.
-
state:
Optional
[str
] Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.
-
street:
Optional
[str
] The street of the recipient’s address.
-
unit:
Optional
[str
] The unit number of the recipient’s address.