msime-engine 0.2.0

Input method engine for Chinese and other languages: quanpin, shuangpin, nine-key, wubi, zhuyin, Cantonese, Japanese, Korean and more, ranked over a word lattice with typo correction and learning from what the user picks. The engine of 水杉输入法 (Metasequoia IME).
Documentation
//! 运行时资源契约(契约版本 1)的文件名。每个文件的格式、谁写谁读、放在哪个根目录下,见 `docs/data-formats.md`。各模块都经这些常量引用文件名,改名只改一处。

pub const CONTRACT_VERSION: i32 = 1;

/// 主词库(拼音各表与 `quick_parases`)。每个代次里有一份工作副本,准备代次时把 `WUBI_DICTIONARY` 的五笔码表并进这份副本。
pub const MAIN_DICTIONARY: &str = "msime-pinyin.db";
/// 单独发布的只读五笔码表(`wubi86`、`wubi98`),从拼音构建产物中拆出。
pub const WUBI_DICTIONARY: &str = "msime-wubi.db";
/// The English dictionary; a working copy lives in each generation.
pub const ENGLISH_DICTIONARY: &str = "msime-english.db";
/// Lattice n-gram tables, copied beside each generation.
pub const BIGRAM_TABLE: &str = "msime-bigram.bin";
pub const TRIGRAM_TABLE: &str = "msime-trigram.bin";
/// Emoji, kaomoji and symbol catalogs; read-only resource.
pub const OTHER_DICTIONARY: &str = "msime-others.db";
pub const JAPANESE_MODEL: &str = "msime-japanese.dat";
pub const JAPANESE_NOTICE: &str = "msime-mozc_dictionary_oss_README.txt";
pub const DICTIONARY_MANIFEST: &str = "msime-dictionary-manifest.json";
/// 统一 `msime-` 前缀之前的文件名,按(现名,旧名)成对列出。升级后还没换成新资源或新代次的目录(Android 已有安装的资源目录、Linux 尚未重新下载的词库、刷新失败时保留的旧代次)里只有旧名文件,`RuntimePaths` 在现名缺席时改用旧名,避免整个输入法没有词库可读。
pub const LEGACY_NAMES: [(&str, &str); 8] = [
    (MAIN_DICTIONARY, "msime.db"),
    (ENGLISH_DICTIONARY, "english.db"),
    (BIGRAM_TABLE, "bigram.bin"),
    (TRIGRAM_TABLE, "trigram.bin"),
    (OTHER_DICTIONARY, "others.db"),
    (JAPANESE_MODEL, "dict_japanese.dat"),
    (JAPANESE_NOTICE, "mozc_dictionary_oss_README.txt"),
    (DICTIONARY_MANIFEST, "dictionary-manifest.json"),
];
/// Hand-written translations; copied from user data or resources into the generation as a sidecar.
pub const TRANSLATIONS: &str = "custom_translations.txt";
/// The user journal every learning write goes through.
pub const USER_JOURNAL: &str = "msime_user.db";
/// The learned-gloss store the host writes (`save_candidate_gloss`) and reads first.
pub const LEARNED_GLOSSES: &str = "translation-glosses.db";
/// Written last into a staged generation; its presence means the generation is complete.
pub const GENERATION_READY: &str = ".ready";

/// Keyboard sentence model (speed), `CandidateSource::NeuralKeyboard`.
pub const NEURAL_MODEL_KEYBOARD: &str = "sentence-model.safetensors";

/// Built-in helpcode schemas and their files under the resource root.
pub const HELPCODES: [(&str, &str); 7] = [
    ("lantian", "helpcodes/helpcode.txt"),
    ("ziranma", "helpcodes/zrm_helpcode_big_unique.txt"),
    ("shouyou2_0", "helpcodes/shouyou2_0_helpcode.txt"),
    ("shouyouplus", "helpcodes/shouyouplus_helpcode.txt"),
    ("xiaohe", "helpcodes/xiaohe_helpcode.txt"),
    ("jiajia", "helpcodes/jiajia_helpcode.txt"),
    ("wubi86", "helpcodes/wubi86_helpcode.txt"),
];

/// `custom/<stem>` 方案从 `helpcodes/custom` 加载,扩展名支持 `.txt` 的 ASCII 大小写变体。
pub const CUSTOM_HELPCODE_PREFIX: &str = "custom/";
pub const CUSTOM_HELPCODE_DIRECTORY: &str = "helpcodes/custom";