kfst-rs
kfst-rs is both the optional acceleration back end of kfst and a self-standing rust implementation of finite-state transducers mostly compatible with HFST. These two functions are liable to being split into multiple crates / packages in the future.
Able to load and execute Voikko and Omorfi: see kfst for transducers converted to a compatible format as well as Python bindings.
Supports the ATT format and its own KFST format. To convert HFST (optimized lookup or otherwise) to ATT using HFST's tools, do:
Using from Python
If you have kfst>=4.1 installed, simply do
to install kfst-rs. It should get automatically picked up by kfst and by extension pyvoikko and pyomorfi.
To check which implementation of kfst got loaded, look at the BACKEND property of kfst.
Using from rust
Given the Voikko transducer in KFST or ATT format, one could create a simple analyzer like this:
use ;
use ;
// Read in transducer
let pathtovoikko = ...
let fst = FSTfrom_kfst_file.unwrap;
// Alternatively, for ATT use FST::from_att_file
// Read in word to analyze
let mut buffer = Stringnew;
let stdin = stdin;
stdin.read_line.unwrap;
buffer = buffer.trim.to_string;
// Do analysis proper
match fst.lookup
Given the input "lentokoneessa", this gives the following analysis:
Analysis 1: [Lt][Xp]lentää[X]len[Ln][Xj]to[X]to[Sn][Ny][Bh][Bc][Ln][Xp]kone[X]konee[Sine][Ny]ssa (0)