#dictionary #concatenation #text

no-std wordbreaker

A Unicode-aware no_std crate (requires alloc) that rapidly finds all sequences of dictionary words that concatenate to a given string

3 releases (breaking)

0.3.0 Sep 19, 2022
0.2.0 Sep 13, 2022
0.1.0 Sep 12, 2022

#1519 in Text processing

32 downloads per month

Apache-2.0 OR MIT

290KB
622 lines

wordbreaker is a Unicode-aware no_std crate (requires alloc) that rapidly finds all sequences of dictionary words that concatenate to a given string.

Example

use wordbreaker::Dictionary;

let dictionary = Dictionary::new(&["hello", "just", "ice", "justice"]);
let mut ways_to_concatenate = dictionary
    .concatenations_for("justice")
    .collect::<Vec<_>>();

ways_to_concatenate.sort_unstable();
assert_eq!(ways_to_concatenate, [vec!["just", "ice"], vec!["justice"]]);

lib.rs:

wordbreaker is a Unicode-aware no_std crate (requires alloc) that rapidly finds all sequences of dictionary words that concatenate to a given string.

Dependencies

~2.7–6MB
~107K SLoC