en_us_normalization.production.verbalize.TimeFst
- class en_us_normalization.production.verbalize.TimeFst(cardinal: Optional[CardinalFst] = None)[source]
Finite state transducer for verbalizing time. Time tokenizer already classifies time zone and suffix and converts them for spelling. Time verbalizer’s job is to remove tags and expand numbers for hours and minutes. There are couple of exceptions to take care of:
hours:00|miunutes:10| - should be twelve ten, i.e. “00” or “0” hours turned into twelve
hours:07|minutes:10| - should be 7, i.e. trailing zero is deleted
hours:12| - for hours without minutes and suffix, “o’clock is appended”
hours:12|minutes:00| - if there is no suffix, “00” minutes are replaced with “o’clock”
Examples if input/output strings:
time|hours:12|minutes:30|suffix:AM|zone:EST| -> twelve thirty AM EST
time|hours:12| -> twelve o’clock
- __init__(cardinal: Optional[CardinalFst] = None)[source]
constructor of time verbalizer
- Parameters
- cardinal: CardinalFst
cardinal to reuse to expand hours and minutes into spoken form