Crate thesaurus[−][src]
Expand description
thesaurus-rs
A thesaurus library for Rust.
thesaurus-rs is extremely simple library for simple programs that need a thesaurus, but don’t need an internet connection. It relies on the JSON file from zaibacu.
It’s simple to use:
use thesaurus::{WordType, Thesaurus}; fn main() { match Thesaurus::synonym("good", Some(WordType::Noun)) { Ok(data) => { let mut synonyms = String::new(); for synonym in data.words { synonyms.push_str(&format!("\n {} ({})", synonym.name, synonym.word_type)); }; println!("Word: {}\nSynonyms:{}", data.name, synonyms); }, Err(error) => eprintln!("Error: {}", error), }; }
Result:
Word: good Synonyms: commodity (Noun) trade good (Noun) goodness (Noun)
Structs
| Thesaurus | The main struct for the Thesaurus |
| Word | Words output by the Thesaurus |
Enums
| Error | Errors output by the Thesaurus |
| WordType | Parts of speech |