Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 1.27 KB

README.md

File metadata and controls

35 lines (26 loc) · 1.27 KB

HFST Optimized Lookup for Rust.

This crate is a port of University of Helsinki's hfst-optimized-lookup to Rust as a library.

⚠️ The crate functionality is not on-par with the original implementation yet! Only weighted transducers are supported at the moment.

The crate can be built for WebAssembly. Also, the crate can be compiled under #![no_std] when setting default-features = false, but actual performance in such an environment has not been tested.

Examples

To read a transducer, use hfstol::read_transducer() function with a &[u8] buffer of binary contents. Created transducers will have a hfstol::Transducer trait.

Examples below use analyser-gt-desc.hfstol analyser file for the Udmurt language.

let content = std::fs::read("./analyser-gt-desc.hfstol").unwrap();
let t = hfstol::read_transducer(&content).unwrap();
println!("{:?}", t.lookup("лэсьтӥськонъёс"));
// Ok([
//     ("лэсьтӥськыны+V+Der/Он+Pl+Nom", 0.0),
//     ("лэсьтӥськон+N+Pl+Nom", 0.0),
// ])

See hfstol::Transducer trait documentation for more info.