| Crates.io | wordnik_list |
| lib.rs | wordnik_list |
| version | 0.2.1 |
| created_at | 2024-12-26 05:17:00.878792+00 |
| updated_at | 2024-12-27 04:53:49.038487+00 |
| description | Quick, local library to check valid words within the Wordnik word list |
| homepage | |
| repository | https://github.com/benjamin-cates/wordnik_list |
| max_upload_size | |
| id | 1495419 |
| size | 3,956,389 |
A quick, local library to query valid English words.
This is a small library that exports useful methods for recognizing valid words from the Wordnik Word List. Definitions, usage, pronunciation, etymology, and examples are omitted. This library uses the official list from wordnik (last synced December 2024). Internally, it uses a static BTreeSet generated at runtime, meaning cross-thread word checking in a small footprint under 10 MB.
Add to your Rust project with cargo add wordnik-list
For the first lookup, generating the map takes around 13 milliseconds in release mode on a mid-range desktop in 2024. For debug mode, initial lookup took around 45 milliseconds.
Runtime is around 300 nanoseconds per lookup in release mode on a mid-range desktop in 2024. For debug mode, runtime per lookup is around 900 nanoseconds.
This crate may change implementation at any time to improve memory efficiency or startup time, but main exported functions should still be there.
Example:
use wordnik_list::word_exists;
let try_words = ["list", "rust", "rusty", "ruster", "abroptly", "assertion"];
// Print which words in that list are invalid
for word in try_words {
if !word_exists(word) {
println!("\"{}\" is not a valid word", word);
}
}
Another example:
use wordnik_list::word_iterator;
// Collect list of every 2-letter word
let vec: Vec<&str> = word_iterator().filter(|word| word.len() == 2).collect();
println!("List of every 2-letter word: {:?}", vec);
no_std flag.word_iterator_by_lenword_iterator, word_exists, and word_range.