use std::path::Path;
use crate::LinderaResult;
use crate::builder::DictionaryBuilder;
use crate::dictionary::UserDictionary;
use crate::util::read_file;
pub struct UserDictionaryLoader;
impl UserDictionaryLoader {
pub fn load_from_bin<P: AsRef<Path>>(path: P) -> LinderaResult<UserDictionary> {
let data = read_file(path.as_ref())?;
UserDictionary::load(&data)
}
pub fn load_from_csv<P: AsRef<Path>>(
builder: DictionaryBuilder,
path: P,
) -> LinderaResult<UserDictionary> {
builder.build_user_dict(path.as_ref())
}
}