diff --git a/double_pinyin.schema.yaml b/double_pinyin.schema.yaml index 11c0279..f97d083 100644 --- a/double_pinyin.schema.yaml +++ b/double_pinyin.schema.yaml @@ -83,13 +83,13 @@ engine: - lua_translator@force_gc # 暴力 GC filters: - lua_filter@corrector # 错音错字提示 + - lua_filter@pin_cand_filter # 置顶候选项 - simplifier@emoji # Emoji - simplifier@traditionalize # 简繁切换 - reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜 - lua_filter@search@radical_pinyin # 部件拆字辅码 - lua_filter@autocap_filter # 英文自动大写 - lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置 - - lua_filter@pin_cand_filter # 置顶候选项 - uniquifier # 去重 @@ -153,7 +153,7 @@ reduce_english_filter: # Lua 配置: 置顶候选项 -# 请参考 rime_ice.schema.yaml 中的注释 +# 注释太长了,请参考 pin_cand_filter.lua 开头的说明书。 pin_cand_filter: # 格式:编码字词1字词2…… - d 的 diff --git a/double_pinyin_abc.schema.yaml b/double_pinyin_abc.schema.yaml index 7ae3a23..ce5813b 100644 --- a/double_pinyin_abc.schema.yaml +++ b/double_pinyin_abc.schema.yaml @@ -83,13 +83,13 @@ engine: - lua_translator@force_gc # 暴力 GC filters: - lua_filter@corrector # 错音错字提示 + - lua_filter@pin_cand_filter # 置顶候选项 - simplifier@emoji # Emoji - simplifier@traditionalize # 简繁切换 - reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜 - lua_filter@search@radical_pinyin # 部件拆字辅码 - lua_filter@autocap_filter # 英文自动大写 - lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置 - - lua_filter@pin_cand_filter # 置顶候选项 - uniquifier # 去重 @@ -153,7 +153,7 @@ reduce_english_filter: # Lua 配置: 置顶候选项 -# 请参考 rime_ice.schema.yaml 中的注释 +# 注释太长了,请参考 pin_cand_filter.lua 开头的说明书。 pin_cand_filter: # 格式:编码字词1字词2…… - d 的 diff --git a/double_pinyin_flypy.schema.yaml b/double_pinyin_flypy.schema.yaml index 1eb271b..fa7abe7 100644 --- a/double_pinyin_flypy.schema.yaml +++ b/double_pinyin_flypy.schema.yaml @@ -83,13 +83,13 @@ engine: - lua_translator@force_gc # 暴力 GC filters: - lua_filter@corrector # 错音错字提示 + - lua_filter@pin_cand_filter # 置顶候选项 - simplifier@emoji # Emoji - simplifier@traditionalize # 简繁切换 - reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜 - lua_filter@search@radical_pinyin # 部件拆字辅码 - lua_filter@autocap_filter # 英文自动大写 - lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置 - - lua_filter@pin_cand_filter # 置顶候选项 - uniquifier # 去重 @@ -153,7 +153,7 @@ reduce_english_filter: # Lua 配置: 置顶候选项 -# 请参考 rime_ice.schema.yaml 中的注释 +# 注释太长了,请参考 pin_cand_filter.lua 开头的说明书。 pin_cand_filter: # 格式:编码字词1字词2…… - d 的 diff --git a/double_pinyin_mspy.schema.yaml b/double_pinyin_mspy.schema.yaml index bcc2df4..63358d2 100644 --- a/double_pinyin_mspy.schema.yaml +++ b/double_pinyin_mspy.schema.yaml @@ -83,13 +83,13 @@ engine: - lua_translator@force_gc # 暴力 GC filters: - lua_filter@corrector # 错音错字提示 + - lua_filter@pin_cand_filter # 置顶候选项 - simplifier@emoji # Emoji - simplifier@traditionalize # 简繁切换 - reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜 - lua_filter@search@radical_pinyin # 部件拆字辅码 - lua_filter@autocap_filter # 英文自动大写 - lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置 - - lua_filter@pin_cand_filter # 置顶候选项 - uniquifier # 去重 @@ -153,7 +153,7 @@ reduce_english_filter: # Lua 配置: 置顶候选项 -# 请参考 rime_ice.schema.yaml 中的注释 +# 注释太长了,请参考 pin_cand_filter.lua 开头的说明书。 pin_cand_filter: # 格式:编码字词1字词2…… - d 的 diff --git a/double_pinyin_sogou.schema.yaml b/double_pinyin_sogou.schema.yaml index 335febc..8576e5b 100644 --- a/double_pinyin_sogou.schema.yaml +++ b/double_pinyin_sogou.schema.yaml @@ -83,13 +83,13 @@ engine: - lua_translator@force_gc # 暴力 GC filters: - lua_filter@corrector # 错音错字提示 + - lua_filter@pin_cand_filter # 置顶候选项 - simplifier@emoji # Emoji - simplifier@traditionalize # 简繁切换 - reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜 - lua_filter@search@radical_pinyin # 部件拆字辅码 - lua_filter@autocap_filter # 英文自动大写 - lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置 - - lua_filter@pin_cand_filter # 置顶候选项 - uniquifier # 去重 @@ -153,7 +153,7 @@ reduce_english_filter: # Lua 配置: 置顶候选项 -# 请参考 rime_ice.schema.yaml 中的注释 +# 注释太长了,请参考 pin_cand_filter.lua 开头的说明书。 pin_cand_filter: # 格式:编码字词1字词2…… - d 的 diff --git a/double_pinyin_ziguang.schema.yaml b/double_pinyin_ziguang.schema.yaml index 6d71f9d..75454c3 100644 --- a/double_pinyin_ziguang.schema.yaml +++ b/double_pinyin_ziguang.schema.yaml @@ -83,13 +83,13 @@ engine: - lua_translator@force_gc # 暴力 GC filters: - lua_filter@corrector # 错音错字提示 + - lua_filter@pin_cand_filter # 置顶候选项 - simplifier@emoji # Emoji - simplifier@traditionalize # 简繁切换 - reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜 - lua_filter@search@radical_pinyin # 部件拆字辅码 - lua_filter@autocap_filter # 英文自动大写 - lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置 - - lua_filter@pin_cand_filter # 置顶候选项 - uniquifier # 去重 @@ -153,7 +153,7 @@ reduce_english_filter: # Lua 配置: 置顶候选项 -# 请参考 rime_ice.schema.yaml 中的注释 +# 注释太长了,请参考 pin_cand_filter.lua 开头的说明书。 pin_cand_filter: # 格式:编码字词1字词2…… - d 的 diff --git a/lua/pin_cand_filter.lua b/lua/pin_cand_filter.lua index 341715c..3b75fc0 100644 --- a/lua/pin_cand_filter.lua +++ b/lua/pin_cand_filter.lua @@ -1,21 +1,68 @@ -- 置顶候选项 --- Powered By ChatGPT +--[[ +《说明书》 -local function is_in_list(list, str) +符合左边的编码(preedit)时,按顺序置顶右边的候选项。只是提升已有候选项的顺序,没有自创编码的功能。 +脚本对比的是去掉空格的 cand.preedit,配置里写空格可以生成额外的编码,参考示例。 + +cand.preedit 是经过 translator/preedit_format 转换后的编码 +⚠️ 注意方案的 preedit_format 设定,如果 v 显示为 ü,那么左边也要写 ü +⚠️ 双拼:显示为全拼拼写就要写全拼,如 'shuang pin',显示为双拼拼写就要写双拼,如 'ul pb' + +格式:编码字词1字词2…… +按照 YAML 语法,加不加引号都行,也可以这么写 pin_cand_filter: [l 了, 'de 的', "ni hao 你好"] + +示例: +- 'le 了' # 输入 le 时,置顶「了」 +- 'ta 他 她 它' # 可以置顶多个字,按顺序排列 +- 'l 了 啦' # 支持单编码,输入 l 时,置顶「了、啦」 +- 'l 了 > 啦' # 右边的字词如果包含空格,用 > 分割也行(大于号左右必须有空格) +- 'ta 啊' # ❌ 编码不会产生的字词,不会生效且影响查找效率。自创编码的字词句可以写到 custom_phrase 中。 +- 'hao 好 👌' # ❌ 不要写 emoji + +### 简拼 +支持简拼,简拼加不加空格都行。但需要方案开启简拼,雾凇全拼是默认开启的,双拼默认没开启 +- s m 什么 +- wsm 为什么 + +### 空格的作用: +无空格,生成原样; +生成 nihao,输入 nihao 时首位是「你好」,但输入 nih 时首位可能是「你会 你还」等其他词语。 +- nihao 你好 +包含空格,额外生成最后一个空格后的拼音的首字母简码; +生成 nihao nih ,现在输入 nih 时首位也会是「你好」。 +- ni hao 你好 +包含空格且结尾以 zh ch sh 开头,再额外生成最后一个空格后的拼音的 zh ch sh 简码; +生成 buhaochi buhaoc buhaoch +- bu hao chi 不好吃 + +### 优先级: +以下两行,会额外生成 'da z' 'da zh' 的置顶,前两个候选项是「大专、大众」,先写的排在前面 +- da zhuang 大专 +- da zhong 大众 +如果明确定义了简码形式,则完全使用简码形式 +此时输入 daz 首位为「打字」,输入 dazh 首位仍为「大专、大众」 +- da z 打字 +--]] + +local function find_index(list, str) for i, v in ipairs(list) do if v == str then - return true, i + return i end end - return false, 0 + return 0 end local M = {} function M.init(env) env.name_space = env.name_space:gsub("^*", "") + + if env.pin_cands ~= nil then return end + local list = env.engine.schema.config:get_list(env.name_space) - if not list then return end -- no configuration found -> stop + if not list or list.size == 0 then return end -- 如果定义了 'da zhuan' 或 'da zhong' ,会自动生成 'daz' 和 'dazh' 的键。 -- 然而,如果明确定义了 'da z' 或 'da zh',则会优先使用这些明确自定义的简码,用 set 来做判断。 @@ -27,34 +74,34 @@ function M.init(env) end end - -- 遍历要置顶的候选项列表,将其转换为 table 存储到 M.pin_cands - -- 'l 了 啦' → M.pin_cands["l"] = {"了", "啦"} - -- 'ta 他 她 它' → M.pin_cands["ta"] = {"他", "她", "它"} + -- 遍历要置顶的候选项列表,将其转换为 table 存储到 env.pin_cands + -- 'l 了 啦' → env.pin_cands["l"] = {"了", "啦"} + -- 'ta 他 她 它' → env.pin_cands["ta"] = {"他", "她", "它"} -- - -- 无空格的键,如 `nihao 你好` → M.pin_cands["nihao"] = {"你好"} + -- 无空格的键,如 `nihao 你好` → env.pin_cands["nihao"] = {"你好"} -- -- 包含空格的的键,同时生成简码的拼写(最后一个空格后的首字母),如: - -- 'ni hao 你好 拟好' → M.pin_cands["nihao"] = {"你好", "拟好"} - -- → M.pin_cands["nih"] = {"你好", "拟好"} + -- 'ni hao 你好 拟好' → env.pin_cands["nihao"] = {"你好", "拟好"} + -- → env.pin_cands["nih"] = {"你好", "拟好"} -- -- 如果最后一个空格后以 zh ch sh 开头,额外再生成 zh, ch, sh 的拼写,如: - -- 'zhi chi 支持' → M.pin_cands["zhichi"] = {"支持"} - -- → M.pin_cands["zhic"] = {"支持"} - -- → M.pin_cands["zhich"] = {"支持"} + -- 'zhi chi 支持' → env.pin_cands["zhichi"] = {"支持"} + -- → env.pin_cands["zhic"] = {"支持"} + -- → env.pin_cands["zhich"] = {"支持"} -- -- 如果同时定义了 'da zhuan 大专' 'da zhong 大众',会生成: - -- M.pin_cands["dazhuan"] = {"大专"} - -- M.pin_cands["dazhong"] = {"大众"} - -- M.pin_cands["daz"] = {"大专", "大众"} -- 先写的排在前面 - -- M.pin_cands["dazh"] = {"大专", "大众"} -- 先写的排在前面 + -- env.pin_cands["dazhuan"] = {"大专"} + -- env.pin_cands["dazhong"] = {"大众"} + -- env.pin_cands["daz"] = {"大专", "大众"} -- 先写的排在前面 + -- env.pin_cands["dazh"] = {"大专", "大众"} -- 先写的排在前面 -- -- 如果同时定义了 'da zhuan 大专' 'da zhong 大众' 且明确定义了简码形式 'da z 打字',会生成: - -- M.pin_cands["dazhuan"] = {"大专"} - -- M.pin_cands["dazhong"] = {"大众"} - -- M.pin_cands["daz"] = {"打字"} -- 明确定义的优先级更高 - -- M.pin_cands["dazh"] = {"大专", "大众"} -- 没明确定义的,仍然按上面的方式生成 + -- env.pin_cands["dazhuan"] = {"大专"} + -- env.pin_cands["dazhong"] = {"大众"} + -- env.pin_cands["daz"] = {"打字"} -- 明确定义的优先级更高 + -- env.pin_cands["dazh"] = {"大专", "大众"} -- 没明确定义的,仍然按上面的方式,先写的排在前面 - M.pin_cands = {} + env.pin_cands = {} for i = 0, list.size - 1 do local preedit, texts = list:get_value_at(i).value:match("([^\t]+)\t(.+)") if #preedit > 0 and #texts > 0 then @@ -65,40 +112,33 @@ function M.init(env) else texts = texts:gsub(" ", delimiter) end + -- 按照键生成完整的拼写 local preedit_no_spaces = preedit:gsub(" ", "") - M.pin_cands[preedit_no_spaces] = {} + env.pin_cands[preedit_no_spaces] = {} for text in texts:gmatch("[^" .. delimiter .. "]+") do - table.insert(M.pin_cands[preedit_no_spaces], text) + table.insert(env.pin_cands[preedit_no_spaces], text) end + -- 额外处理包含空格的 preedit,增加最后一个拼音的首字母和 zh, ch, sh 的简码 if preedit:find(" ") then local preceding_part, last_part = preedit:match("^(.+)%s(%S+)$") - if #last_part > 0 then - -- 生成最后一个拼音的简码拼写(最后一个空格后的首字母),如 ni hao 生成 nih - local p1 = preceding_part:gsub(" ", "") .. last_part:sub(1, 1) + local p1, p2 = "", "" + -- p1 生成最后一个拼音的首字母简码拼写(最后一个空格后的首字母),如 ni hao 生成 nih + p1 = preceding_part:gsub(" ", "") .. last_part:sub(1, 1) + -- p2 生成最后一个拼音的 zh, ch, sh 的简码拼写(最后一个空格后以 zh ch sh 开头),如 zhi chi 生成 zhich + if last_part:match("^[zcs]h") then + p2 = preceding_part:gsub(" ", "") .. last_part:sub(1, 2) + end + for _, p in ipairs({ p1, p2 }) do -- 只在没有明确定义此简码时才生成,已有的追加,没有的直接赋值 - if not set[p1] then - if M.pin_cands[p1] ~= nil then + if p ~= "" and not set[p] then + if env.pin_cands[p] ~= nil then for text in texts:gmatch("[^" .. delimiter .. "]+") do - table.insert(M.pin_cands[p1], text) + table.insert(env.pin_cands[p], text) end else - M.pin_cands[p1] = M.pin_cands[preedit_no_spaces] - end - end - -- 生成最后一个拼音的 zh, ch, sh 的简码拼写(最后一个空格后以 zh ch sh 开头),如 zhi chi 生成 zhich - if last_part:match("^[zcs]h") then - local p2 = preceding_part:gsub(" ", "") .. last_part:sub(1, 2) - -- 只在没有明确定义此简码时才生成,已有的追加,没有的直接赋值 - if not set[p2] then - if M.pin_cands[p2] ~= nil then - for text in texts:gmatch("[^" .. delimiter .. "]+") do - table.insert(M.pin_cands[p2], text) - end - else - M.pin_cands[p2] = M.pin_cands[preedit_no_spaces] - end + env.pin_cands[p] = env.pin_cands[preedit_no_spaces] end end end @@ -113,77 +153,74 @@ function M.func(input, env) local full_preedit = env.engine.context:get_preedit().text -- 非汉字部分的 preedit,如 shij local letter_only_preedit = string.gsub(full_preedit, "[^a-zA-Z]", "") - -- 是否正在选词(已经选择了至少一个字词,如 `你好shij` 这种状态) - -- local isSelecting = full_preedit ~= letter_only_preedit - -- If there is no configuration, no filtering will be performed - if not M.pin_cands or #letter_only_preedit == 0 then + if env.pin_cands == nil or next(env.pin_cands) == nil or #letter_only_preedit == 0 then for cand in input:iter() do yield(cand) end return end - local pined = {} -- 提升的候选项 + --[[ + full_preedit 与候选项的情况 + hao 好、号、毫 ... 哈、蛤、铪 + 你hao 好、号、毫 ... 哈、蛤、铪 + haobu 好不、毫不 ... 好、号、毫 ... 哈、蛤、铪 + 你haobu 好不、毫不 ... 好、号、毫 ... 哈、蛤、铪 + 简化为 letter_only_preedit 与候选项的情况 + hao 好、号、毫 ... 哈、蛤、铪 + haobu 好不、毫不 ... 好、号、毫 ... 哈、蛤、铪 + + 在循环中随着候选项的变化,cand.preedit 也跟着变化: + | letter_only_preedit | cand.preedit | + |---------------------|-----------------------------| + | dian | dian ... di | + | ha | ha | + | hao | hao ... ha | + | haobu | hao bu ... hao ... ha | + --]] + + -- 用 pined 和 others 调整顺序,找齐后先遍历 pined 再遍历 others + local pined = {} -- 提升的候选项 local others = {} -- 其余候选项 local pined_count = 0 for cand in input:iter() do - local cand_preedit_no_spaces = cand.preedit:gsub(" ", "") + local preedit = cand.preedit:gsub(" ", "") -- 对比去掉空格的 cand.preedit + local texts = env.pin_cands[preedit] - -- 无关的输入直接 break - if string.find(letter_only_preedit, "^" .. cand_preedit_no_spaces) == nil then - yield(cand) - break - end - - local texts = M.pin_cands[cand_preedit_no_spaces] - - -- 跳过不需要处理的部分,对后续的候选项排序 if texts == nil then - yield(cand) + -- 当前候选项无须排序,直接 yield 并结束循环 + -- 当前候选项正在排序,例如要置顶某个 `hao`,但从 `hao` 查到 `ha` 了还没找齐,不能直接 yield,要先输出 pined 和 others 中的 `hao` + if letter_only_preedit == preedit then + yield(cand) + else + table.insert(others, cand) + end + break else -- 给 pined 几个空字符串占位元素,后面直接 pined[idx] = cand 确保 pined 与 texts 顺序一致 if #pined < #texts then for _ = 1, #texts do - table.insert(pined, '') - end - end - -- 处理简繁转换后的问题 - local cand_text = cand.text - if cand:get_dynamic_type() == "Shadow" then - -- handle cands converted by simplifier - local originalCand = cand:get_genuine() - if #originalCand.text == #cand_text and not is_in_list({ "↑", "←", "→", "↓", "丶", "✅", "✔", "⭕" }, cand.text) then - -- 笑|😄 cand_text = 😄; 麼|么 cand_text = 麼; - cand_text = originalCand.text + table.insert(pined, "") end end -- 要置顶的放到 pined 中,其余的放到 others - local ok, idx = is_in_list(texts, cand_text) - if ok then + local idx = find_index(texts, cand.text) + if idx ~= 0 then pined[idx] = cand pined_count = pined_count + 1 else table.insert(others, cand) end - -- 找齐了或者 others 太大了,就不找了,一般前 5 个就找完了 - if pined_count == #texts or #others > 50 then + -- 找齐了或查询超过 100 个就不找了(如果要提升的候选项不在前 100 则不会被提升) + if pined_count == #texts or #others > 100 then break end end end -- yield pined others 及后续的候选项 - if pined_count > 0 then - -- 如果因配置写了这个编码没有的字词,导致没有找齐,删掉空字符串占位元素 - local i = 1 - while i <= #pined do - if pined[i] == '' then - table.remove(pined, i) - else - i = i + 1 - end - end - for _, cand in ipairs(pined) do + for _, cand in ipairs(pined) do + if cand ~= "" then yield(cand) end end diff --git a/others/CHANGELOG.md b/others/CHANGELOG.md index e3d511a..7342bbb 100644 --- a/others/CHANGELOG.md +++ b/others/CHANGELOG.md @@ -4,6 +4,13 @@ +## 2024-02-09 ♻️ + +重构了 `pin_cand_filter.lua` 置顶候选项功能。 [#675](https://github.com/iDvel/rime-ice/issues/675) + +- 调整了方案中 `engine/filters` 的排序 +- 不再需要在配置中写 emoji,emoji 可自动吸附。 + ## 2024-02-04 ⚠️ ⚠️ 中英混输词库由英文方案附属切换到单独的 table_translator ([#662](https://github.com/iDvel/rime-ice/pull/662)) diff --git a/rime_ice.schema.yaml b/rime_ice.schema.yaml index a197886..d7754fd 100644 --- a/rime_ice.schema.yaml +++ b/rime_ice.schema.yaml @@ -6,7 +6,7 @@ schema: schema_id: rime_ice name: 雾凇拼音 - version: "2024-02-06" + version: "2024-02-09" author: - Dvel description: | @@ -72,6 +72,7 @@ engine: - lua_translator@force_gc # 暴力 GC filters: - lua_filter@corrector # 错音错字提示 + - lua_filter@pin_cand_filter # 置顶候选项(顺序要求:置顶候选项 > Emoji > 简繁切换) - simplifier@emoji # Emoji - simplifier@traditionalize # 简繁切换 - reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜 @@ -79,7 +80,6 @@ engine: - lua_filter@v_filter # v 模式 symbols 优先(否则是英文优先) - lua_filter@autocap_filter # 英文自动大写 - lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置 - - lua_filter@pin_cand_filter # 置顶候选项 - lua_filter@long_word_filter # 长词优先 - uniquifier # 去重 @@ -152,76 +152,35 @@ reduce_english_filter: # Lua 配置: 置顶候选项 -# 符合左边的编码(cand.preedit)时,按顺序置顶右边的候选项。只是提升已有候选项的顺序,没有自创编码的功能。 -# 脚本对比的是去掉空格的 cand.preedit,配置里写空格可以生成额外的编码,参考示例。 -# -# cand.preedit 是经过 translator/preedit_format 转换后的编码 -# ⚠️ 注意方案的 preedit_format 设定,如果 v 显示为 ü,那么左边也要写 ü -# ⚠️ 双拼:显示为全拼拼写就要写全拼,如 'shuang pin',显示为双拼拼写就要写双拼,如 'ul pb' -# -# 格式:编码字词1字词2…… -# 按照 YAML 语法,加不加引号都行,也可以这么写 pin_cand_filter: [l 了, 'de 的', "ni hao 你好"] -# -# 示例: -# - 'le 了' # 输入 le 时,置顶「了」 -# - 'la 啦' # 输入 la 时,置顶「啦」 -# - 'ta 他 她 它' # 可以置顶多个字,按顺序排列 -# - 'ta 啊' # ❌ 编码不会产生的字词,不会生效且影响查找效率。自创编码的字词句可以写到 custom_phrase 中。 -# - 'l 了 啦' # 支持单编码,输入 l 时,置顶「了、啦」 -# -### 简拼 -# 支持简拼,简拼加不加空格都行。但需要方案开启简拼,雾凇全拼是默认开启的,双拼默认没开启 -# - s m 什么 -# - wsm 为什么 -# -### Emoji -# 如果词汇有 emoji 映射,在调整排序后,相关 emoji 失去吸附效果,所以要将 emoji 也纳入 -# - kan 看 👀 -# - ni hao 你好 👋 拟好 -# -### 空格的作用: -# 不包含空格,只生成原样: -# - 'nihao 你好' # 只生成 nihao,只有输入完整编码时才起作用,输入 nihao 时首位是「你好」,但输入 nih 时首位可能是「你会 你还」等其他词语 -# 包含空格的词组,额外生成最后一个空格后的拼音的首字母简码: -# - 'ni hao 你好' # 生成 nihao nih -# 包含空格的词组,且结尾以 zh ch sh 开头,再额外生成最后一个空格后的拼音的 zh ch sh 简码: -# - 'bu hao chi 不好吃' # 生成 buhaochi buhaoc buhaoch -# -### 优先级: -# 以下两行,会额外生成 'da z' 'da zh' 的置顶,前两个候选项是「大专、大众」,先写的排在前面 -# - da zhuang 大专 -# - da zhong 大众 -# 如果明确定义了简码形式,则完全使用简码形式 -# - da z 打字 -# - da zh 打仗 +# 注释太长了,请参考 pin_cand_filter.lua 开头的说明书。 pin_cand_filter: # 格式:编码字词1字词2…… - # ⚙️ 以下是个人习惯,仅供参考,可以打个补丁来覆盖。 + # ⚙️ 以下是个人习惯,仅供参考,推荐打补丁用自己的习惯覆盖。 # 单编码 - q 去 千 - w 我 万 往 - - e 呃 🤔 + - e 呃 - r 让 人 - t 他 她 它 祂 - y 与 于 # - u 在 custom_phrase 置顶了 有 🈶 又 由 # - i 在 custom_phrase 置顶了 一 1️⃣ 以 已 亦 - - o 哦 😮 + - o 哦 - p 片 篇 - - a 啊 😲 😦 😧 + - a 啊 - s 是 时 使 式 - - d 的 地 得 🉐 + - d 的 地 得 - f 发 放 分 - g 个 各 - h 和 或 - j 及 将 即 既 继 - - k 可 🉑 + - k 可 - l 了 啦 喽 嘞 - z 在 再 自 - x 想 像 向 - c 才 从 # - v - - b 吧 把 呗 百 + - b 把 吧 呗 百 - n 那 哪 拿 呐 - m 吗 嘛 呣 # 常用单字 @@ -229,27 +188,27 @@ pin_cand_filter: - qu 去 - wo 我 - wei 为 - - er 而 儿 二 2️⃣ + - er 而 儿 二 - en 嗯 - rang 让 - ta 他 她 它 祂 - tai 太 - tong 同 - yu 与 于 - - you 有 🈶 又 由 + - you 有 又 由 - yao 要 - ye 也 - shi 是 时 使 式 - suo 所 - - shang 上 ⬆️ ↑ + - shang 上 - shuo 说 - - de 的 地 得 🉐 + - de 的 地 得 - dan 但 - dou 都 - dao 到 倒 - - dian 点 · 丶 + - dian 点 - dang 当 - - dui 对 ⭕ ✅ ✔ + - dui 对 - fa 发 - ge 个 各 - gang 刚 @@ -257,12 +216,12 @@ pin_cand_filter: - huo 或 - hui 会 - hai 还 - - hao 好 👌 🙆‍♂️ 🙆‍♀️ + - hao 好 - ji 及 即 既 - jiu 就 - jiang 将 - - ke 可 🉑 - - kan 看 👀 + - ke 可 + - kan 看 - kai 开 - le 了 - la 啦 拉 @@ -274,16 +233,16 @@ pin_cand_filter: - zhen 真 - zui 最 - zheng 正 - - zuo 做 坐 左 ⬅️ ← + - zuo 做 坐 左 - ze 则 - xiang 想 像 向 - xian 先 - - xia 下 ⬇️ ↓ + - xia 下 - xing 行 - cai 才 - cong 从 - chu 出 - - ba 吧 把 + - ba 把 吧 - bu 不 - bing 并 - bei 被 @@ -321,7 +280,7 @@ pin_cand_filter: - hh 哈哈 - kk 看看 - cc 常常 - - xx 想想 🤔 想象 + - xx 想想 想象 - yw 因为 - sm 什么 - wsm 为什么