US Mail V2

Sample Code:

class UsMailV2(raw_prediction)

US Mail API version 2 inference prediction.

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] = '2'

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[UsMailV2Document]]

Page-level prediction(s).

prediction: UsMailV2Document

Document-level prediction.

product: Product

Name and version of a given product, as sent back by the API.

class UsMailV2Document(raw_prediction, page_id=None)

US Mail API version 2.0 document data.

Parameters:
  • raw_prediction (Dict[str, Any]) –

  • page_id (Optional[int]) –

recipient_addresses: List[UsMailV2RecipientAddress]

The addresses of the recipients.

recipient_names: List[StringField]

The names of the recipients.

sender_address: UsMailV2SenderAddress

The address of the sender.

sender_name: StringField

The name of the sender.

class UsMailV2SenderAddress(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 UsMailV2RecipientAddress(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.