Skip to main content

msime_engine/
assets.rs

1//! 运行时资源契约(契约版本 1)的文件名。每个文件的格式、谁写谁读、放在哪个根目录下,见 `docs/data-formats.md`。各模块都经这些常量引用文件名,改名只改一处。
2
3pub const CONTRACT_VERSION: i32 = 1;
4
5/// 主词库(拼音各表与 `quick_parases`)。每个代次里有一份工作副本,准备代次时把 `WUBI_DICTIONARY` 的五笔码表并进这份副本。
6pub const MAIN_DICTIONARY: &str = "msime-pinyin.db";
7/// 单独发布的只读五笔码表(`wubi86`、`wubi98`),从拼音构建产物中拆出。
8pub const WUBI_DICTIONARY: &str = "msime-wubi.db";
9/// The English dictionary; a working copy lives in each generation.
10pub const ENGLISH_DICTIONARY: &str = "msime-english.db";
11/// Lattice n-gram tables, copied beside each generation.
12pub const BIGRAM_TABLE: &str = "msime-bigram.bin";
13pub const TRIGRAM_TABLE: &str = "msime-trigram.bin";
14/// Emoji, kaomoji and symbol catalogs; read-only resource.
15pub const OTHER_DICTIONARY: &str = "msime-others.db";
16pub const JAPANESE_MODEL: &str = "msime-japanese.dat";
17pub const JAPANESE_NOTICE: &str = "msime-mozc_dictionary_oss_README.txt";
18pub const DICTIONARY_MANIFEST: &str = "msime-dictionary-manifest.json";
19/// 统一 `msime-` 前缀之前的文件名,按(现名,旧名)成对列出。升级后还没换成新资源或新代次的目录(Android 已有安装的资源目录、Linux 尚未重新下载的词库、刷新失败时保留的旧代次)里只有旧名文件,`RuntimePaths` 在现名缺席时改用旧名,避免整个输入法没有词库可读。
20pub const LEGACY_NAMES: [(&str, &str); 8] = [
21    (MAIN_DICTIONARY, "msime.db"),
22    (ENGLISH_DICTIONARY, "english.db"),
23    (BIGRAM_TABLE, "bigram.bin"),
24    (TRIGRAM_TABLE, "trigram.bin"),
25    (OTHER_DICTIONARY, "others.db"),
26    (JAPANESE_MODEL, "dict_japanese.dat"),
27    (JAPANESE_NOTICE, "mozc_dictionary_oss_README.txt"),
28    (DICTIONARY_MANIFEST, "dictionary-manifest.json"),
29];
30/// Hand-written translations; copied from user data or resources into the generation as a sidecar.
31pub const TRANSLATIONS: &str = "custom_translations.txt";
32/// The user journal every learning write goes through.
33pub const USER_JOURNAL: &str = "msime_user.db";
34/// The learned-gloss store the host writes (`save_candidate_gloss`) and reads first.
35pub const LEARNED_GLOSSES: &str = "translation-glosses.db";
36/// Written last into a staged generation; its presence means the generation is complete.
37pub const GENERATION_READY: &str = ".ready";
38
39/// Keyboard sentence model (speed), `CandidateSource::NeuralKeyboard`.
40pub const NEURAL_MODEL_KEYBOARD: &str = "sentence-model.safetensors";
41
42/// Built-in helpcode schemas and their files under the resource root.
43pub const HELPCODES: [(&str, &str); 7] = [
44    ("lantian", "helpcodes/helpcode.txt"),
45    ("ziranma", "helpcodes/zrm_helpcode_big_unique.txt"),
46    ("shouyou2_0", "helpcodes/shouyou2_0_helpcode.txt"),
47    ("shouyouplus", "helpcodes/shouyouplus_helpcode.txt"),
48    ("xiaohe", "helpcodes/xiaohe_helpcode.txt"),
49    ("jiajia", "helpcodes/jiajia_helpcode.txt"),
50    ("wubi86", "helpcodes/wubi86_helpcode.txt"),
51];
52
53/// `custom/<stem>` 方案从 `helpcodes/custom` 加载,扩展名支持 `.txt` 的 ASCII 大小写变体。
54pub const CUSTOM_HELPCODE_PREFIX: &str = "custom/";
55pub const CUSTOM_HELPCODE_DIRECTORY: &str = "helpcodes/custom";