Skip to content

方案配置详解

高级主题

本文面向需要手动编辑配置的用户。普通用户通过设置工具即可完成日常配置。

配置分层:全局配置 + 方案文件 + 方案覆盖

方案配置分两级管理:用户可配的引擎行为(上屏策略、调频、造词、模糊音等)是全局配置,集中在 config.toml[schema.codetable] / [schema.pinyin] / [schema.mix] 三段,同类方案共享;方案文件(*.schema.toml)只包含引擎固定参数(最大码长、词库、双拼布局等)。

三个层次各司其职:

位置内容
全局引擎配置config.toml[schema.codetable/pinyin/mix]所有同类方案共享的行为基线
方案文件data\schemas\*.schema.toml + 用户 schemas\*.schema.toml引擎类型、码长、词库、双拼布局等固定参数
方案覆盖schema_overrides\<方案ID>.toml单个码表方案对全局码表行为的逐字段覆盖

设置工具的方案页是这些配置的图形入口;本页是配置文件字段参考。

全局码表配置 [schema.codetable]

所有码表方案(五笔等)的公共行为基线。出厂默认(data\config.toml):

toml
[schema.codetable]
top_code_commit = true       # 顶码上屏(超满码长取前 N 码首选上屏)
clear_on_empty_max = false   # 满码无候选时清空缓冲
auto_commit_at_full = false  # 满码唯一精确时自动上屏
punct_commit = true          # 标点触发上屏
show_code_hint = true        # 显示编码提示
single_code_input = false    # 精确匹配模式(关闭前缀匹配)
single_code_complete = true  # 精确匹配空码补全(无候选时从更长编码取首选)
z_key_repeat = true          # z 键重复上一次上屏
字段说明出厂默认
top_code_commit顶码上屏true
clear_on_empty_max满码空码清空false
auto_commit_at_full满码唯一自动上屏false
punct_commit标点顶码上屏true
show_code_hint显示编码提示true
single_code_input精确匹配模式false
single_code_complete精确匹配空码补全true
z_key_repeatz 键重复输入true

码表调频 [schema.codetable.frequency]

toml
[schema.codetable.frequency]
enabled = false              # 启用词频调整
protect_top_n = 1            # 锁定码表原始前 N 位不参与调频(0=不锁定)
strategy = "top"             # top(一次到顶 MRU)/ step(逐次提升)

码表自动造词 [schema.codetable.auto_phrase]

toml
[schema.codetable.auto_phrase]
enabled = false              # 连续选字后自动组词入用户词库

min_phrase_len(默认 2)、max_phrase_len(默认 10)、promote_count 为隐藏字段,一般无需调整。

全局拼音配置 [schema.pinyin]

所有拼音类方案(全拼/双拼/混输拼音子方案/临时拼音反查)共用一份。出厂默认:

toml
[schema.pinyin]
show_code_hint = true        # 拼音候选旁显示编码
use_smart_compose = true     # 智能组词
separator = "auto"           # 拼音分隔符:auto / quote / backtick / none

模糊音 [schema.pinyin.fuzzy]

toml
[schema.pinyin.fuzzy]
enabled = false              # 模糊音总开关
zh_z = false                 # zh ↔ z
ch_c = false                 # ch ↔ c
sh_s = false                 # sh ↔ s
n_l  = false                 # n ↔ l
r_l  = false                 # r ↔ l
f_h  = false                 # f ↔ h
an_ang   = false             # an ↔ ang
en_eng   = false             # en ↔ eng
in_ing   = false             # in ↔ ing
ian_iang = false             # ian ↔ iang
uan_uang = false             # uan ↔ uang

启用 enabled 后逐对开启需要的模糊音,开启的拼音对在输入时互不区分。共 11 组。

拼音调频 [schema.pinyin.frequency]

toml
[schema.pinyin.frequency]
enabled = true               # 启用拼音调频(出厂默认开)
half_life = 0                # 半衰期(小时,0=用内置默认 72 小时)
base_scale = 0               # base 系数(0=用内置默认 100)
recency_peak = 0             # 最近使用峰值加成(0=不启用,即内置默认)

拼音调频是时间衰减打分:越近使用的词得分越高,随时间按半衰期衰减,公式为 (base_scale × log2(次数+1) + recency_peak) × 2^(-距上次使用小时数/half_life)。三个数值参数为 0 时使用引擎内置默认(72 小时 / 100 / 0)。

拼音自动造词 [schema.pinyin.auto_learn]

toml
[schema.pinyin.auto_learn]
enabled = true               # 连续选词后自动组词入用户词库(出厂默认开)
min_word_length = 0          # 最短学习词长(0=回退 2)
promote_count = 0            # 临时词晋升所需使用次数

全局混输配置 [schema.mix]

融合策略,全局唯一,无方案级覆盖。出厂默认:

toml
[schema.mix]
show_source_hint = false           # 显示候选来源标记(码表/拼音)
enable_english = false             # 启用英文候选
pinyin_only_overflow = true        # 超码长时仅查拼音
top_code_override_pinyin = false   # 顶码优先(覆盖拼音)
auto_commit_block_on_pinyin = false # 有拼音候选时否决满码上屏
block_commit_on_pinyin_word = true # 整串是强拼音词时否决自动/顶码上屏(如 wangba→网吧),独立于上一项
pinyin_word_min_weight = 0         # 拼音歧义拦截的词强度阈值(0=仅结构判据:≥2 汉字且消费整串)
auto_commit_block_on_english = false # 有英文候选时否决满码上屏(仅启用英文候选时有意义)
min_pinyin_length = 2              # 拼音最小触发长度(0=回退 2)
min_english_length = 3             # 英文最小触发长度(0=回退 3,即 2 字符以内不查英文)

快捷输入 [schema.quick_input]

日期/计算/数字转大小写等内置快捷输入。出厂默认:

toml
[schema.quick_input]
enabled = true               # 启用快捷输入
force_vertical = true        # 进入快捷输入时强制竖排候选(退出恢复原布局)
decimal_places = 6           # 计算结果最多保留的小数位数(0=取整)
enable_english = true        # 快捷模式混入英文候选(低优先级排在拼音后)

快捷输入通过引导键触发。引导键不在 [schema.quick_input] 里,而在融合模式列表 schema.mix_modes 中定义:

toml
[[schema.mix_modes]]
id = "quick_mix"
name = "快捷"
short_name = "快"
trigger_keys = ["semicolon"]              # 引导键(默认分号 ; ,可多选)
members = ["quick_input", "pinyin", "english"]  # 按序合并候选的成员方案

mix_modes 是「引导键触发、合并多个成员方案候选」的融合模式列表;默认的 quick_mix 用分号触发,同时提供快捷输入、拼音与英文候选。

方案覆盖 schema_overrides

只有码表方案支持行为覆盖。单方案的覆盖写在 %APPDATA%\WindInput\schema_overrides\<方案ID>.toml[codetable] 段,由设置工具维护。

toml
[codetable]
enabled = true               # 总开关:false 或缺省时整段忽略,逐字段回落全局
top_code_commit = false      # 显式写出的字段覆盖全局,未写的字段回落 [schema.codetable]
single_code_input = true

enabledtrue 时,各显式写出的字段覆盖全局 [schema.codetable],未写出的字段仍回落全局值。可覆盖字段:top_code_commitclear_on_empty_maxauto_commit_at_fullauto_commit_min_lenpunct_commitshow_code_hintsingle_code_inputsingle_code_completez_key_repeat

INFO

词库启停([[dictionaries]] enabled)与双拼布局([engine.pinyin.shuangpin] layout)不走 schema_overrides,而是直接深合并到用户 schemas\<方案ID>.schema.toml

方案文件的引擎固定参数

方案文件(*.schema.toml)现在只保留引擎无法从全局推断的固定参数。

码表引擎 [engine.codetable]

toml
[engine.codetable]
max_code_length = 4          # 最大码长(0=构建时回退 4)
base_sort = "weight"         # 基础排序:weight(默认)/ natural(字根序)
input_chars = ""             # 输入码字符集,如 "a-x" / "a-z"(空=默认)

拼音引擎 [engine.pinyin]

toml
[engine.pinyin]
scheme = "full"              # full(全拼)/ shuangpin(双拼)
unigram_path = "pinyin/unigram.txt"  # unigram 语言模型路径(长句打分用)

[engine.pinyin.shuangpin]
layout = "xiaohe"            # 双拼布局:xiaohe / ziranma / mspy / sogou / abc / ziguang

行为字段在全局

show_code_hintuse_smart_compose、模糊音等行为字段在全局 [schema.pinyin] 配置,不写在方案文件里。

混输引擎 [engine.mixed]

toml
[engine.mixed]
primary_schema = "wubi86"    # 主方案(码表)
secondary_schema = "pinyin"  # 辅助方案(拼音)
codetable_weight_boost = 10000000  # 码表精确匹配提权基线(0=回退 10_000_000)

关于 codetable_weight_boost

这是层间隔离机制:把整个码表层(短语 + 用户词库 + 系统码表)压在拼音字之前,让码表编码即便与拼音冲突也稳定靠前。它是引擎固定参数,不写入用户存储,也与词频调整无关。融合策略(enable_english / min_pinyin_length 等)在全局 [schema.mix] 配置。

拆字提示 [engine.chaizi]

形码方案可挂拆字库,在候选悬停提示里显示构字信息(路径相对 data\schemas\):

toml
[engine.chaizi]
db_path = "wubi86/wubi86_chaizi.txt"   # 拆字库(字\t字根\t编码)
font_path = "wubi86/HeiTiZiGen.ttf"    # 字根字体 TTF
font_family = "黑体字根"               # 字根字体的 DirectWrite 家族名

词库配置

每个方案的 dictionaries 数组列出所有词库,分主词库(default = true,仅一个)与附加词库。

toml
[[dictionaries]]
id = "wubi86_main"
label = "极点五笔主词库"
description = "极点五笔基础词库,含单字与高频词组"
path = "wubi86/wubi86_jidian.dict.yaml"   # 词库文件为 Rime YAML 格式
type = "rime_codetable"
default = true

[[dictionaries]]
id = "wubi86_emoji"
label = "Emoji 表情"
path = "wubi86/wubi86_jidian_emoji.dict.yaml"
type = "rime_codetable"
default_enabled = true       # 附加词库的方案默认启用状态
weight_as_order = true
字段类型说明
idstring词库 ID,全局唯一
labelstringUI 显示名,留空回退 id
descriptionstring设置工具开关下方的小字说明
pathstring词库文件路径,相对 data\ / 用户数据根目录
typestringrime_codetable / rime_pinyin / english(空=回退 rime_codetable
defaultbool是否为主词库(每方案有且仅一个)
default_enabledbool附加词库的方案默认启用状态(省略=false)
enabledbool用户覆盖启用状态(由设置工具写入,未设时继承 default_enabled
weight_as_orderbool权重仅表示同码内排序序号,不参与跨码比较
weight_spectable权重归一化参数,见下文

启用判定优先级:enabled > default_enabled > 主词库始终启用

词库权重 [dictionaries.weight_spec]

toml
[[dictionaries]]
id = "pinyin_main"

[dictionaries.weight_spec]
median = 200                 # 中位权重
max = 19260817               # 最大权重
mode = "log"                 # linear(线性)/ log(对数)

某些码表词库(如极点五笔)的权重并非真实词频,而是同编码内的重码序号。对这类词库加 weight_as_order = true,前缀匹配时同一剩余码长层内权重被统一,按码表文件原始顺序排列,精确匹配不受影响。

反查词库

拼音方案可挂反查词库,在编码提示中显示其他方案的编码:

toml
[[dictionaries]]
id = "wubi86_reverse"
type = "rime_codetable"

编码器 [encoder]

根据规则自动为词组生成编码,常用于五笔方案:

toml
[encoder]
max_word_length = 10

[[encoder.rules]]
length_equal = 2             # 二字词
formula = "AaAbBaBb"         # 第一字前两码 + 第二字前两码

[[encoder.rules]]
length_equal = 3             # 三字词
formula = "AaBaCaCb"

[[encoder.rules]]
length_in_range = [4, 10]    # 四字及以上
formula = "AaBaCaZa"

公式语法:A/B/C/Z = 第 1、2、3、末个字;a/b = 该字的第 1、2 个编码(如 Aa = 第 1 字第 1 码)。

短语词库的存储

短语(PhraseLayer)是全局共享的(不区分方案),数据存放在用户数据目录的 userdata.redb 中,编辑入口在设置 → 词库 → 快捷短语

启动时引擎读 system.phrases.toml 作为系统种子,把内置短语合并进数据库:

路径角色
<安装目录>\data\system.phrases.toml程序自带系统短语种子,只读,升级随包替换
%APPDATA%\WindInput\system.phrases.toml用户目录同名覆盖文件,存在时优先
toml
[[phrases]]
code = 'date'
text = '$Y年$M月$D日'
weight = 1000                # 0~10000 同 tier 排序权重
position = 1                 # 同 code 多条时 tie-break(升序)

不是用户编辑入口

不要直接编辑 system.phrases.toml 来添加自己的短语——它仅是系统种子,重装/升级可能被覆盖,且改动不会自动同步进数据库。用户自定义短语请通过设置 → 词库 → 快捷短语添加,会直接写入 userdata.redb,跨方案立即生效。

数据共享与隔离

拼音家族共享用户数据

全拼(pinyin)与双拼(shuangpin)的用户词库、调频、临时词库统一存储,双拼用户切到全拼仍能看到学过的词。混输方案与其主形码方案共享用户数据。

方案实际数据归属
pinyin(全拼)pinyin
shuangpin(双拼)pinyin(与全拼共享)
wubi86(五笔)wubi86
wubi86_pinyin(混输)wubi86(与五笔共享)

隔离方式一览

数据类隔离方式
短语词库全局,所有方案共用
系统码表(各方案 dictionaries)按方案
用户词库 / 临时词库 / 调频按方案数据归属(拼音家族、混输有共享,见上表)

如需创建自定义方案,请参阅方案配置制作