1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
//! This crate is fairly low level, I reccomend you use the higher-level [`thesaurus`](https://crates.io/crates/thesaurus) crate.
use libflate::gzip::Decoder;
use std::io::Read;
const WORDNET_DICT_COMPRESSED: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/wordnet.gz"));
/// Uncompress the dictionary from memory.
pub fn uncompress() -> String {
let mut dec = Decoder::new(WORDNET_DICT_COMPRESSED)
.expect("Failed to initialize runtime dictionary decoder");
let mut output = Vec::new();
dec.read_to_end(&mut output)
.expect("Failed to decompress dictionary");
String::from_utf8(output).unwrap()
}