use super::AutoCorrect;
use std::sync::RwLock;
use config::{Config};
use hashbrown::HashMap;
lazy_static! {
static ref WORDS_SET: RwLock<Box<HashMap<String, u32>>> = RwLock::new(Box::new(HashMap::new()));
static ref REVERSE_DICT: RwLock<Box<HashMap<String, Vec<String>>>> = RwLock::new(Box::new(HashMap::new()));
}
pub(crate) fn initialize(service: &AutoCorrect) {
if let Err(e) = populate_words_set(&service.config) {
eprintln!("Failed to initialize: {}", e);
return;
}
}
pub(crate) fn set_reverse_dict(dict: HashMap<String, Vec<String>>) {
if let Ok(mut rev_dict) = REVERSE_DICT.write() {
*rev_dict = Box::new(dict);
}
}
fn populate_words_set(_config: &Config) -> Result<(), String> {
Ok(())
}