11.3. twol.fs module

fs.py: A wrapper module for basic finite-state operations

The HFST engine used for accomplishing the operations but all functions make copies of their arguments when it is necessary to avoid side-effects.

© Kimmo Koskenniemi, 2018. This is free code under the GPL 3 license.

twol.fs.compose(f, g)[source]

Return the composition of two FSTs

twol.fs.concat(f, g)[source]

Return the concatenation of two FSTs

twol.fs.crossprod(f, g)[source]

Return the cross-product of two FSAs


Return an FST corresponding to a XFST regular expression

twol.fs.intersect(f, g)[source]

Return the intersection of two FSTs

Both arguments are assumed to be length preserving mappings.


Return the output projection of an FST


Return the Kleene plus iteration of an FST


Return the Kleene star iteration of an FST


Return a FSA which accepts the sequence of graphemes in the string

twol.fs.symbol_pair_to_fst(insym, outsym)[source]

“Return a FST which accepts one the pair string ‘insym:outsym’


Return a FSA which accepts the one letter string ‘sym’

The symbol ‘sym’ may be e.g. a composed Unicode grapheme, i.e. a string of two or more Unicode characters.

twol.fs.union(f, g)[source]

Return the union of two FSTs


Return the input projection of an FST