en_us_normalization.production.verbalize.RomanFst

class en_us_normalization.production.verbalize.RomanFst(cardinal: Optional[CardinalFst] = None, ordinal: Optional[OrdinalFst] = None)[source]

Finite state transducer for verbalizing roman numerals. By default, romans are expanded as cardinals. But for some prefixes, they should be expanded as ordinals (for ex. georg the first). This distinction happens during tagging, verbalizer just applies expansion depending on the field name (count or order). Prefixes are coming from pre-defined list and do not require verbalization.

Examples of input/output strings:

  • roman|count:25| -> twenty five

  • roman|prefix:chapter|count:26| -> chapter twenty six

  • roman|prefix:george|order:1| -> george the first

__init__(cardinal: Optional[CardinalFst] = None, ordinal: Optional[OrdinalFst] = None)[source]

constructor for roman numerals verbalizer

Parameters
cardinal: CardinalFst

reusing cardinal verbalizer, this is the one mostly applied

ordinal: OrdinalFst

reusing ordinal verbalizer. applied only with specific prefixes