From 03fdc656896811b0593223893f613dd3a3273030 Mon Sep 17 00:00:00 2001 From: Mintimate <43734212+Mintimate@users.noreply.github.com> Date: Wed, 2 Oct 2024 14:18:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BA=A0=E9=94=99=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=8E=9F=E6=9C=89=E6=B3=A8=E9=87=8A=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 如果想保持原本的自动纠错功能,可以修改方案内的 corrector_filter/keep_source_comment 为 true resolved: #91 --- double_pinyin.schema.yaml | 7 ++++++- double_pinyin_abc.schema.yaml | 7 ++++++- double_pinyin_flypy.schema.yaml | 7 ++++++- double_pinyin_mspy.schema.yaml | 7 ++++++- double_pinyin_sogou.schema.yaml | 7 ++++++- double_pinyin_ziguang.schema.yaml | 7 ++++++- lua/corrector_filter.lua | 17 ++++++++++++++--- rime_mint.schema.yaml | 8 ++++++-- rime_mint_flypy.schema.yaml | 7 ++++++- terra_pinyin.schema.yaml | 7 ++++++- 10 files changed, 68 insertions(+), 13 deletions(-) diff --git a/double_pinyin.schema.yaml b/double_pinyin.schema.yaml index 6cbbf35..4fa56b6 100644 --- a/double_pinyin.schema.yaml +++ b/double_pinyin.schema.yaml @@ -9,7 +9,7 @@ schema: schema_id: double_pinyin name: "自然码双拼-薄荷定制" - version: "24.09.25" + version: "24.10.02" author: - Dvel - Mintimate @@ -145,6 +145,11 @@ reduce_english_filter: zach ] +# 错音错字提示 +corrector_filter: + # 当文字没有触发错字错音的情况下,保持原本的注释 + keep_source_comment: false + # 中国农历配置 chineseLunarCalendar_translator: lunar diff --git a/double_pinyin_abc.schema.yaml b/double_pinyin_abc.schema.yaml index bf02305..23eb190 100644 --- a/double_pinyin_abc.schema.yaml +++ b/double_pinyin_abc.schema.yaml @@ -9,7 +9,7 @@ schema: schema_id: double_pinyin_abc name: "智能ABC双拼-薄荷定制" - version: "24.09.25" + version: "24.10.02" author: - Dvel - Mintimate @@ -146,6 +146,11 @@ reduce_english_filter: zach ] +# 错音错字提示 +corrector_filter: + # 当文字没有触发错字错音的情况下,保持原本的注释 + keep_source_comment: false + # 中国农历配置 chineseLunarCalendar_translator: lunar diff --git a/double_pinyin_flypy.schema.yaml b/double_pinyin_flypy.schema.yaml index 5902ef9..d7e4f8d 100644 --- a/double_pinyin_flypy.schema.yaml +++ b/double_pinyin_flypy.schema.yaml @@ -9,7 +9,7 @@ schema: schema_id: double_pinyin_flypy name: "小鹤双拼-薄荷定制" - version: "24.09.25" + version: "24.10.02" author: - Mintimate description: | @@ -164,6 +164,11 @@ reduce_english_filter: tad, tail, taj, tar, tax, tec, ted, tel, ter, tex, tic, tied, tier, ties, tim, tin, tit, tour, tout, tum, wag, wand, womens, wap, wax, weir, won, yan, yen] + +# 错音错字提示 +corrector_filter: + # 当文字没有触发错字错音的情况下,保持原本的注释 + keep_source_comment: false # 中国农历配置 chineseLunarCalendar_translator: lunar diff --git a/double_pinyin_mspy.schema.yaml b/double_pinyin_mspy.schema.yaml index 031040b..f5b349c 100644 --- a/double_pinyin_mspy.schema.yaml +++ b/double_pinyin_mspy.schema.yaml @@ -9,7 +9,7 @@ schema: schema_id: double_pinyin_mspy name: "微软双拼-薄荷定制" - version: "24.09.25" + version: "24.10.02" author: - Dvel - Mintimate @@ -145,6 +145,11 @@ reduce_english_filter: zach ] +# 错音错字提示 +corrector_filter: + # 当文字没有触发错字错音的情况下,保持原本的注释 + keep_source_comment: false + # 中国农历配置 chineseLunarCalendar_translator: lunar diff --git a/double_pinyin_sogou.schema.yaml b/double_pinyin_sogou.schema.yaml index ce161c8..b822fc5 100644 --- a/double_pinyin_sogou.schema.yaml +++ b/double_pinyin_sogou.schema.yaml @@ -9,7 +9,7 @@ schema: schema_id: double_pinyin_sogou name: "搜狗双拼-薄荷定制" - version: "24.09.25" + version: "24.10.02" author: - Dvel - Mintimate @@ -146,6 +146,11 @@ reduce_english_filter: zach ] +# 错音错字提示 +corrector_filter: + # 当文字没有触发错字错音的情况下,保持原本的注释 + keep_source_comment: false + # 中国农历配置 chineseLunarCalendar_translator: lunar diff --git a/double_pinyin_ziguang.schema.yaml b/double_pinyin_ziguang.schema.yaml index 0dcafc7..86d9bdd 100644 --- a/double_pinyin_ziguang.schema.yaml +++ b/double_pinyin_ziguang.schema.yaml @@ -9,7 +9,7 @@ schema: schema_id: double_pinyin_ziguang name: "紫光双拼-薄荷定制" - version: "24.09.25" + version: "24.10.02" author: - Dvel - Mintimate @@ -146,6 +146,11 @@ reduce_english_filter: zach ] +# 错音错字提示 +corrector_filter: + # 当文字没有触发错字错音的情况下,保持原本的注释 + keep_source_comment: false + # 中国农历配置 chineseLunarCalendar_translator: lunar diff --git a/lua/corrector_filter.lua b/lua/corrector_filter.lua index 92b48d6..894b8cd 100644 --- a/lua/corrector_filter.lua +++ b/lua/corrector_filter.lua @@ -14,6 +14,9 @@ local M = {} function M.init(env) local config = env.engine.schema.config local delimiter = config:get_string('speller/delimiter') + env.name_space = env.name_space:gsub('^*', '') + -- 是否保持原有注释 + M.keep_source_comment = config:get_bool(env.name_space .. "/keep_source_comment") if delimiter and #delimiter > 0 and delimiter:sub(1,1) ~= ' ' then env.delimiter = delimiter:sub(1,1) end @@ -24,7 +27,6 @@ function M.init(env) ["hun dun"] = { text = "馄饨", comment = "hún tun" }, ["zhu jiao"] = { text = "主角", comment = "zhǔ jué" }, ["jiao se"] = { text = "角色", comment = "júe sè" }, - ["pi sa"] = { text = "比萨", comment = "bǐ sà" }, ["chi pi sa"] = { text = "吃比萨", comment = "chī bǐ sà" }, ["pi sa bing"] = { text = "比萨饼", comment = "bǐ sà bǐng" }, ["shui fu"] = { text = "说服", comment = "shuō fú" }, @@ -94,6 +96,10 @@ function M.init(env) ["nan jing liu he"] = { text = "南京六合", comment = "nán jīng lù hé" }, ["nan jing shi liu he"] = { text = "南京六合区", comment = "nán jīng lù hé qū" }, ["nan jing shi liu he qu"] = { text = "南京市六合区", comment = "nán jīng shì lù hé qū" }, + ["nuo da"] = { text = "偌大", comment = "偌(ruò)大" }, + ["yin jiu zhi ke"] = { text = "饮鸩止渴", comment = "饮鸩(zhèn)止渴" }, + ["yin jiu jie ke"] = { text = "饮鸩解渴", comment = "饮鸩(zhèn)解渴" }, + ["gong shang jiao zhi yu"] = { text = "宫商角徵羽", comment = "宫商角(jué)徵羽" }, -- 错字 ["pu jie"] = { text = "扑街", comment = "仆街" }, ["pu gai"] = { text = "扑街", comment = "仆街" }, @@ -113,7 +119,7 @@ function M.init(env) ["cou huo"] = { text = "凑活", comment = "凑合(he)" }, ["ju hui"] = { text = "钜惠", comment = "巨惠" }, ["mo xie zuo"] = { text = "魔蝎座", comment = "摩羯(jié)座" }, - ["nuo da"] = { text = "诺大", comment = "偌(ruò)大" }, + ["pi sa"] = { text = "披萨", comment = "比(bǐ)萨" }, } end @@ -129,7 +135,12 @@ function M.func(input, env) if c and cand.text == c.text then cand:get_genuine().comment = string.gsub(M.style, "{comment}", c.comment) else - cand:get_genuine().comment = "" + -- 20241002 是否保持原本注释;如: 拼音 + if M.keep_source_comment then + cand:get_genuine().comment = string.gsub(M.style, "{comment}", pinyin) + else + cand:get_genuine().comment = "" + end end end yield(cand) diff --git a/rime_mint.schema.yaml b/rime_mint.schema.yaml index ef6c350..c3aac09 100755 --- a/rime_mint.schema.yaml +++ b/rime_mint.schema.yaml @@ -4,7 +4,7 @@ schema: schema_id: rime_mint name: 薄荷拼音-全拼输入 - version: "24.09.25" + version: "24.10.02" author: - mintimate < @Mintimate|https://www.mintimate.cn > description: | @@ -141,7 +141,11 @@ reduce_english_filter: tad, tail, taj, tar, tax, tec, ted, tel, ter, tex, tic, tied, tier, ties, tim, tin, tit, tour, tout, tum, wag, wand, womens, wap, wax, weir, won, yan, yen] - + +# 错音错字提示 +corrector_filter: + # 当文字没有触发错字错音的情况下,保持原本的注释 + keep_source_comment: false # 中国农历配置 chineseLunarCalendar_translator: lunar diff --git a/rime_mint_flypy.schema.yaml b/rime_mint_flypy.schema.yaml index 293163f..3bae3a4 100755 --- a/rime_mint_flypy.schema.yaml +++ b/rime_mint_flypy.schema.yaml @@ -4,7 +4,7 @@ schema: schema_id: rime_mint_flypy name: 薄荷拼音-小鹤混输 - version: "24.09.25" + version: "24.10.02" author: - mintimate < @Mintimate|https://www.mintimate.cn > description: | @@ -142,6 +142,11 @@ reduce_english_filter: tad, tail, taj, tar, tax, tec, ted, tel, ter, tex, tic, tied, tier, ties, tim, tin, tit, tour, tout, tum, wag, wand, womens, wap, wax, weir, won, yan, yen] + +# 错音错字提示 +corrector_filter: + # 当文字没有触发错字错音的情况下,保持原本的注释 + keep_source_comment: false # 中国农历配置 chineseLunarCalendar_translator: lunar diff --git a/terra_pinyin.schema.yaml b/terra_pinyin.schema.yaml index 69381ad..848f8d0 100755 --- a/terra_pinyin.schema.yaml +++ b/terra_pinyin.schema.yaml @@ -1,7 +1,7 @@ schema: schema_id: terra_pinyin name: "地球拼音-薄荷定制" - version: "24.09.25" + version: "24.10.02" author: - 佛振 - mintimate < @Mintimate|https://www.mintimate.cn > @@ -120,6 +120,11 @@ reduce_english_filter: wag, wand, womens, wap, wax, weir, won, yan, yen] +# 错音错字提示 +corrector_filter: + # 当文字没有触发错字错音的情况下,保持原本的注释 + keep_source_comment: false + speller: alphabet: 'zyxwvutsrqponmlkjihgfedcba-;/<,>\' initials: zyxwvutsrqponmlkjihgfedcba