en_us_normalization.production.classify.OrdinalFst

class en_us_normalization.production.classify.OrdinalFst(cardinal: Optional[CardinalFst] = None)[source]

Finite state transducer for classifying ordinal, i.e. cardinals with suffix In english there are just 4 suffixes to take of:

  • st - follows “1”

  • nd - follows “2”

  • rd - follows “3”

  • th - follows all the other digits. Also used for 11, 12, 13.

Examples of input and tagged strings:

  • 13th -> ordinal { order: “13” }

  • 23rd -> ordinal { order: “23” }

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

constructor of ordinal transducer

Parameters
cardinal: CardinalFst

transducer to reuse to accept numbers if not provided, instantiated from scratch