11.9. twol.twbt module¶
Module for detailed handling basic transducers
Copyright 2015-2020, Kimmo Koskenniemi
This program is free software under Gnu GPL 3 or later
- twol.twbt.equivpairs(bfst)[source]¶
Find and print all sets of equivalent transition pairs.
bfst – a HfstIterableTransducer whose transition symbol pairs are analyzed
Sets of transition symbol pairs behaving identicaly are computed. The sets are printed if they contain more than one element.
- twol.twbt.fst_to_fsa(FST, separator='^')[source]¶
Converts FST into an FSA by joining input and output symbols with separator
- twol.twbt.pairname(insym, outsym)[source]¶
Convert a pair of symbols into a single label
insym – input symbol as a string outsym – output symbol as a string
Returns a string notation of the pair, eg.
>>> pairname ('a', 'a') a >>> pairname('i','j') i:j
- twol.twbt.ppfst(FST, print_equiv_classes=True, title='')[source]¶
Pretty-prints a HfstTransducer or a HfstIterableTransducer.
FST – the transducer to be pretty-printed print_equiv_classes – if True, then print also the equivalence classes title – an explicit additional title to be printed
If the transducer has a name, it is printed as a heading.
>>> twbt.ppfst(hfst.regex("a* [b:p|c] [c|b:p]"), True) 0 . -> 0 a ; -> 1 b:p ; 1 . -> 2 b ; 2 : Classes of equivalent symbols: b:p c