Crates.io | pyphen-rs |
lib.rs | pyphen-rs |
version | 0.1.0 |
source | src |
created_at | 2019-05-27 21:50:36.524338 |
updated_at | 2019-05-27 21:50:36.524338 |
description | A pure Rust port of Pyphen, a Python hyphenation library |
homepage | https://github.com/nareshganduri/pyphen-rs |
repository | https://github.com/nareshganduri/pyphen-rs |
max_upload_size | |
id | 137416 |
size | 9,987,617 |
A pure Rust port of Python's Pyphen library.
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
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.