PyFoma.js
Demo
Program
Wrap
Run
Clear output
$consonant = /[a-z] - [aeiou]/ // Introduction // This demoes a pyfoma port to js (see https://github.com/mhulden/pyfoma) // You can compile regexes into finite-state automata and transducers // Everything runs in the browser // Writing /regex/ by itself compiles a regex an immediately displays it // You can also write regexes and store the FSTs into variables. Example: // $consonant = [a-z] - [aeiou] // ... and then re-use the definition in new regexes: // $syllable = $consonant+ [aeiou] $consonant+ // view($variable) displays the FST // generate($variable, string, string, ...) passes strings to the FST // analyze($variable, string, string, ...) does the inverse calculation // Example: $myfst = $^rewrite(a:b / c _ d) view($myfst) generate($myfst, cadcab, cab) analyze($myfst, cbd) // You can save an FST in .foma format for // import into foma or pyfoma, with // tofoma($myfst) // and then "Save output..." // See pull-down menu above for more examples
Output
Save output…
Fit graph
(No graph yet. Run
view(...)
.)