1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//use std::io;

//use byteorder::WriteBytesExt;
//use byteorder::{ByteOrder, LittleEndian};
//use lindera_core::dict::character_definition::CharacterDefinitions;
//use lindera_core::dict::connection::ConnectionCostMatrix;
//use lindera_core::dict::prefix_dict::PrefixDict;
//use lindera_core::dict::system_dict::SystemDict;
//use lindera_core::dict::unknown_dictionary::UnknownDictionary;
//use serde::{Deserialize, Serialize};

const CHAR_DEFINITION_DATA: &'static [u8] = include_bytes!("../dict/char_def.bin");
static CONNECTION_DATA: &'static [u8] = include_bytes!("../dict/matrix.mtx");
const IPADIC_DATA: &'static [u8] = include_bytes!("../dict/dict.fst");
const IPADIC_VALS: &'static [u8] = include_bytes!("../dict/dict.vals");
const DICTIONARY_DATA: &'static [u8] = include_bytes!("../dict/dict.fst");
const UNKNOWN_DATA: &'static [u8] = include_bytes!("../dict/unk.bin");
const WORDS_DATA: &'static [u8] = include_bytes!("../dict/dict.words");
const WORDS_IDX_DATA: &'static [u8] = include_bytes!("../dict/dict.wordsidx");

//pub fn char_def() -> CharacterDefinitions {
//    bincode::deserialize(CHAR_DEFINITION_DATA).unwrap()
//}
pub fn char_def() -> &'static [u8] {
    CHAR_DEFINITION_DATA
}

//pub fn connection_cost() -> ConnectionCostMatrix {
//    let backward_size = LittleEndian::read_i16(&CONNECTION_DATA[..2]);
//    ConnectionCostMatrix {
//        costs_data: &CONNECTION_DATA[4..],
//        backward_size: backward_size as u32,
//    }
//}
pub fn connection_data() -> &'static [u8] {
    CONNECTION_DATA
}

//pub fn prefix_dict() -> PrefixDict<&'static [u8]> {
//    PrefixDict::from_static_slice(IPADIC_DATA, IPADIC_VALS).unwrap()
//}
pub fn ipadic_data() -> &'static [u8] {
    IPADIC_DATA
}
pub fn ipadic_vals() -> &'static [u8] {
    IPADIC_VALS
}

//pub fn system_dict() -> SystemDict<&'static [u8]> {
//    SystemDict::from_static_slice(DICTIONARY_DATA).unwrap()
//}
pub fn system_dict() -> &'static [u8] {
    DICTIONARY_DATA
}

//pub fn unknown_dict() -> UnknownDictionary {
//    bincode::deserialize(UNKNOWN_DATA).unwrap()
//}
pub fn unknown_dict() -> &'static [u8] {
    UNKNOWN_DATA
}

pub fn word_data() -> &'static [u8] {
    WORDS_DATA
}

pub fn word_index_data() -> &'static [u8] {
    WORDS_IDX_DATA
}