Exemple #1
0
def make_fst(*custom_arcs: str, a_and_b='positive') -> FST:
    """
    To make a complete FST, add one or more arcs that go from state 1 to state 2.
    There are existing arcs to state 1 that set x <- a, set x <- b, and do not define x.

    a_and_b can be either 'positive' for @P.x.V@ flags or 'unify' for @U.x.V@
    flags.
    """

    a_and_b_arcs = UNIFY_ARCS if a_and_b == 'unify' else POSITIVE_SET_ARCS

    arcs = (ACCEPT_C, ACCEPTING_STATE, *a_and_b_arcs, *custom_arcs)
    source = HEADER + '\n'.join(arcs) + FOOTER
    return FST.from_text(source)
Exemple #2
0
def english_flags_fst(english_flags_fst_txt: str) -> FST:
    """
    Return the FST that uses flag diacritics and tranduces
    pay/payable/unpayable/do/undo/doable/undoable.
    """
    return FST.from_text(english_flags_fst_txt)
Exemple #3
0
def eat_fst(eat_fst_txt: str) -> FST:
    """
    Return the FST that analyzes eat/eats/eaten/eating/ate.
    """
    return FST.from_text(eat_fst_txt)