Expand description
§use-word
Composable word-level text primitives for RustUse.
use-word builds on conservative word boundaries and normalized lowercase comparisons. It is meant
for practical text inspection, not stemming, language modeling, or linguistic analysis.
§Included primitives
word_countunique_wordsnormalize_wordcontains_wordstarts_with_wordends_with_wordwords
§Example
use use_word::{contains_word, unique_words, word_count};
assert_eq!(word_count("Hello, hello world"), 3);
assert!(contains_word("Hello, world", "world"));
assert_eq!(unique_words("Hello, hello world").len(), 2);Structs§
Functions§
- contains_
word - Returns
truewhen the input contains the target as a full normalized word. - ends_
with_ word - Returns
truewhen the last normalized word matches the target. - normalize_
word - Normalizes a word-like value by lowercasing letters and dropping non-word punctuation.
- starts_
with_ word - Returns
truewhen the first normalized word matches the target. - unique_
words - Returns distinct normalized words in first-seen order.
- word_
count - Counts normalized words in the input.
- words
- Extracts normalized words from the input.