Crate hypher

source ·
Expand description

hypher separates words into syllables.

§Features

  • All-inclusive: Hyphenation patterns are embedded into the binary as efficiently encoded finite automata at build time.
  • Zero load time: Hyphenation automata operate directly over the embedded binary data with no up-front decoding.
  • No allocations unless when hyphenating very long words (> 41 bytes). You can disable the alloc feature, but then overly long words lead to a panic.
  • Support for many languages.
  • No unsafe code, no dependencies, no std.

§Example

use hypher::{hyphenate, Lang};

let mut syllables = hyphenate("extensive", Lang::English);
assert_eq!(syllables.join("-"), "ex-ten-sive");

§Languages

By default, this crate supports hyphenating more than 30 languages. Embedding automata for all these languages will add ~1.1 MiB to your binary. Alternatively, you can disable support for all languages and manually choose which ones get added:

[dependencies]
hypher = { version = "0.1", default-features = false, features = ["english", "greek"] }

Structs§

  • An iterator over the syllables of a word.

Enums§

  • A language you can hyphenate in.

Functions§

  • Segment a word into syllables.
  • Segment a word into syllables, but forbid breaking betwen the given number of chars to each side.