#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 个版本 (breaking)

0.3.0 2022年9月19日
0.2.0 2022年9月13日
0.1.0 2022年9月12日

#1563 in 文本处理

Apache-2.0 OR MIT

290KB
622 行代码(不含注释)

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

示例

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.

依赖

~3–13MB
~148K SLoC