en_us_normalization.production.verbalize.CardinalFst

class en_us_normalization.production.verbalize.CardinalFst[source]

Finite state transducer for verbalizing cardinal number. A pretrained FAR is used to avoid writing down all the rules for number expansion. Check verbalizer specification for list of possible fields.

Apart from cardinal expansion, grammar also provides some fsts to be reused in other semiotic classes:

  • expand number digit by digit

  • expand number grouping digits in to pairs

Examples of input/output strings:

  • cardinal|negative:1|count:23| -> minus twenty three

  • cardinal|prefix:number|count:21| -> number twenty one

__init__()[source]
get_cardinal_expanding_fst()[source]

helper function that provides and fst to expand cardinals. 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.

get_digit_by_digit_fst()[source]

helper function that provides fst to expand numbers digit by digit. It can be used in verbatim, decimal, etc.

get_digit_pairs_fst()[source]

helper function that provides fst to expand numbers by digit pairs, i.e. “2012 -> twenty twelve”