Skip to main content

Crate use_word

Crate use_word 

Source
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_count
  • unique_words
  • normalize_word
  • contains_word
  • starts_with_word
  • ends_with_word
  • words

§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§

Word
A normalized word token.
WordStats
Aggregate counts derived from text.

Functions§

contains_word
Returns true when the input contains the target as a full normalized word.
ends_with_word
Returns true when 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 true when 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.