- class en_us_normalization.production.verbalize.OrdinalFst(cardinal: Optional[CardinalFst] = None)
Finite state transducer for verbalizing ordinal. It pretty much reuses verbalization from cardinal, rewriting last word or only ending of it. If number ends with 1-9 or 12, the whole last word has to be modified. This is done using mapping from files:
For others, grammar just appends “th” or rewrites “ty” to “tieth”.
Examples of input/output strings:
ordinal|order:13| -> thirteenth
ordinal|order:21| -> twenty first
- __init__(cardinal: Optional[CardinalFst] = None)
constructor of ordinal verbalization transducer
- cardinal: CardinalFst
reusing cardinal to expand numbers to words.
helper function that provides and fst to expand ordinals. can be reused by other semiotic classes. simply attach to your own FST or cross with permissive FST to limit number of digits for expansion.