#python #port #pure #hyphenation #language #pyphen

pyphen-rs

A pure Rust port of Pyphen, a Python hyphenation library

1 unstable release

0.1.0 May 27, 2019

#8 in #hyphenation

GPL-2.0+ AND LGPL-2.1+ AND MPL-1.1

3MB
578 lines

pyphen-rs

A pure Rust port of Python's Pyphen library.

Usage

use pyphen_rs;

assert_eq!(pyphen_rs::language_fallback("nl_NL_variant1").unwrap(), "nl_NL");

pyphen_rs::LANGUAGES.with(|l|) {
    assert!(l.borrow().contains_key("nl_NL"));
};

let dic = pyphen_rs::Builder::lang("nl_NL").build().unwrap();
assert_eq!(dic.inserted("lettergrepen"), "let-ter-gre-pen");

let wrap = dic.wrap("autobandventieldopje", 11); // Some(("autoband-", "ventieldopje"))
let iter = dic.iterate("Amsterdam"):
iter.next(); // Some(("Amster", "dam"))
iter.next(); // Some(("Am", "sterdam"))
iter.next(); // None

License

Pyphen-rs is released under the GPL 2.0+/LGPL 2.1+/MPL 1.1 tri-license. See COPYING.GPL, COPYING.LGPL and COPYING.MPL for more details.


lib.rs:

A pure Rust port of Python's Pyphen.

Dependencies