amounts ¶
Precise English quantities and currencies with bounded object attachment.
AmountMention dataclass ¶
An exact quantity and object label at a source-text span.
Attributes:
| Name | Type | Description |
|---|---|---|
text | str | Matched quantity text. |
start | int | Zero-based character offset of the quantity. |
end | int | Exclusive end offset of the quantity. |
amount | Decimal | Exact numeric value as a |
object_type | str | Attached object label or normalized currency name. |
AmountResult dataclass ¶
Amount matches for the original input text.
Attributes:
| Name | Type | Description |
|---|---|---|
text | str | Analyzed body. |
mentions | tuple[AmountMention, ...] | Quantities in source order. |
analyze_amounts ¶
Extract exact English quantities and currencies with short object labels.
Dates, percentages, and indefinite quantities are excluded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text | str | Prepared English body. | required |
numeric_order | NumericDateOrder | None |
| None |
Returns:
| Type | Description |
|---|---|
AmountResult | Quantities with exact decimal values and source character offsets. |
Raises:
| Type | Description |
|---|---|
TypeError | If |
ValueError | If |