en_us_normalization.production.classify.FractionFst
- class en_us_normalization.production.classify.FractionFst(cardinal: Optional[CardinalFst] = None)[source]
Finite state transducer for classifying fraction, for ex. “23 4/5”. Fractions consists of
optional integer part
numerator of the fraction
denominator of the fraction
Sometimes fraction is specified with specialized character, for ex. “¾”. Those are enumerated in numbers/fractions.tsv, which also provides proper tagging
Examples of input and tagged output:
“23 4/5” -> fraction { integer_part: “23” numerator: “4” denominator: “5” }
- __init__(cardinal: Optional[CardinalFst] = None)[source]
constructor of fraction fst
- Parameters
- cardinal: CardinalFst
transducer for cardinal digits to reuse. if not provided, cardinal fst will be created from scratch