lindera_dictionary/loader/unknown_dictionary.rs
1use std::path::Path;
2
3use crate::LinderaResult;
4use crate::dictionary::unknown_dictionary::UnknownDictionary;
5use crate::util::read_aligned_file;
6
7/// Loader for unknown dictionary data from disk files.
8pub struct UnknownDictionaryLoader {}
9
10impl UnknownDictionaryLoader {
11 /// Load unknown dictionary from a file in the specified directory.
12 ///
13 /// # Arguments
14 ///
15 /// * `input_dir` - Path to the directory containing unk.bin.
16 ///
17 /// # Returns
18 ///
19 /// An `UnknownDictionary` loaded from the file.
20 pub fn load(input_dir: &Path) -> LinderaResult<UnknownDictionary> {
21 let aligned_data = read_aligned_file(input_dir.join("unk.bin").as_path())?;
22
23 UnknownDictionary::load(&aligned_data)
24 }
25}