From a2194517085b46ffcbe85786606dd7bfb2cebf23 Mon Sep 17 00:00:00 2001 From: Dvel Date: Tue, 17 Oct 2023 02:32:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20reduce=5Fenglish=5Ffilter.lua=20?= =?UTF-8?q?=E5=8F=AF=E8=AF=86=E5=88=AB=E5=90=AB=E5=8D=95=E5=BC=95=E5=8F=B7?= =?UTF-8?q?=E7=9A=84=E5=8D=95=E8=AF=8D=20close=20#519?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- double_pinyin.schema.yaml | 2 +- double_pinyin_abc.schema.yaml | 2 +- double_pinyin_flypy.schema.yaml | 2 +- double_pinyin_mspy.schema.yaml | 2 +- double_pinyin_sogou.schema.yaml | 2 +- double_pinyin_ziguang.schema.yaml | 2 +- lua/reduce_english_filter.lua | 10 +++++----- rime_ice.schema.yaml | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/double_pinyin.schema.yaml b/double_pinyin.schema.yaml index 74c6176..b653d21 100644 --- a/double_pinyin.schema.yaml +++ b/double_pinyin.schema.yaml @@ -108,7 +108,7 @@ reduce_english_filter: lux, moc, mos, mot, mum, nad, nay, nib, nip, pak, pap, pax, rig, rum, sac, sal, sax, sec, shin, sis, ska, slang, sus, tad, taj, tac, tic, yep, yum, fax, cain, key, mob, buy, dam, wap, yes, but, put, lag, buf, lip, aid, aim, dig, dim, din, - dip, pail, cad, chap, bend, lid, gem, tin, tum, my] + dip, pail, cad, chap, bend, lid, gem, tin, tum, my, went, youd, hes] # 主翻译器,拼音 diff --git a/double_pinyin_abc.schema.yaml b/double_pinyin_abc.schema.yaml index 1ef96fc..325d6fe 100644 --- a/double_pinyin_abc.schema.yaml +++ b/double_pinyin_abc.schema.yaml @@ -107,7 +107,7 @@ reduce_english_filter: lux, moc, mos, mot, mum, nad, nay, nib, nip, pak, pap, pax, rig, rum, sac, sal, sax, sec, shin, sis, ska, slang, sus, tad, taj, tac, tic, yep, yum, fax, cain, key, mob, buy, dam, wap, yes, but, put, lag, buf, lip, aid, aim, dig, dim, din, - dip, pail, cad, chap, bend, lid, gem, tin, tum, my] + dip, pail, cad, chap, bend, lid, gem, tin, tum, my, went, youd, hes] # 主翻译器,拼音 diff --git a/double_pinyin_flypy.schema.yaml b/double_pinyin_flypy.schema.yaml index 8288a1e..5e3ce54 100644 --- a/double_pinyin_flypy.schema.yaml +++ b/double_pinyin_flypy.schema.yaml @@ -108,7 +108,7 @@ reduce_english_filter: lux, moc, mos, mot, mum, nad, nay, nib, nip, pak, pap, pax, rig, rum, sac, sal, sax, sec, shin, sis, ska, slang, sus, tad, taj, tac, tic, yep, yum, fax, cain, key, mob, buy, dam, wap, yes, but, put, lag, buf, lip, aid, aim, dig, dim, din, - dip, pail, cad, chap, bend, lid, gem, tin, tum, my] + dip, pail, cad, chap, bend, lid, gem, tin, tum, my, went, youd, hes] # 主翻译器,拼音 diff --git a/double_pinyin_mspy.schema.yaml b/double_pinyin_mspy.schema.yaml index 8389515..2dad994 100644 --- a/double_pinyin_mspy.schema.yaml +++ b/double_pinyin_mspy.schema.yaml @@ -108,7 +108,7 @@ reduce_english_filter: lux, moc, mos, mot, mum, nad, nay, nib, nip, pak, pap, pax, rig, rum, sac, sal, sax, sec, shin, sis, ska, slang, sus, tad, taj, tac, tic, yep, yum, fax, cain, key, mob, buy, dam, wap, yes, but, put, lag, buf, lip, aid, aim, dig, dim, din, - dip, pail, cad, chap, bend, lid, gem, tin, tum, my] + dip, pail, cad, chap, bend, lid, gem, tin, tum, my, went, youd, hes] # 主翻译器,拼音 diff --git a/double_pinyin_sogou.schema.yaml b/double_pinyin_sogou.schema.yaml index c36203a..9ba8c4a 100644 --- a/double_pinyin_sogou.schema.yaml +++ b/double_pinyin_sogou.schema.yaml @@ -108,7 +108,7 @@ reduce_english_filter: lux, moc, mos, mot, mum, nad, nay, nib, nip, pak, pap, pax, rig, rum, sac, sal, sax, sec, shin, sis, ska, slang, sus, tad, taj, tac, tic, yep, yum, fax, cain, key, mob, buy, dam, wap, yes, but, put, lag, buf, lip, aid, aim, dig, dim, din, - dip, pail, cad, chap, bend, lid, gem, tin, tum, my] + dip, pail, cad, chap, bend, lid, gem, tin, tum, my, went, youd, hes] # 主翻译器,拼音 diff --git a/double_pinyin_ziguang.schema.yaml b/double_pinyin_ziguang.schema.yaml index 35684bd..24c9f41 100644 --- a/double_pinyin_ziguang.schema.yaml +++ b/double_pinyin_ziguang.schema.yaml @@ -108,7 +108,7 @@ reduce_english_filter: lux, moc, mos, mot, mum, nad, nay, nib, nip, pak, pap, pax, rig, rum, sac, sal, sax, sec, shin, sis, ska, slang, sus, tad, taj, tac, tic, yep, yum, fax, cain, key, mob, buy, dam, wap, yes, but, put, lag, buf, lip, aid, aim, dig, dim, din, - dip, pail, cad, chap, bend, lid, gem, tin, tum, my] + dip, pail, cad, chap, bend, lid, gem, tin, tum, my, went, youd, hes] # 主翻译器,拼音 diff --git a/lua/reduce_english_filter.lua b/lua/reduce_english_filter.lua index cbca494..0db4e4c 100644 --- a/lua/reduce_english_filter.lua +++ b/lua/reduce_english_filter.lua @@ -8,7 +8,7 @@ function M.init(env) local config = env.engine.schema.config env.name_space = env.name_space:gsub("^*", "") M.idx = config:get_int(env.name_space .. "/idx") -- 要插入的位置 - M.words = {} -- 要过滤的词 + M.words = {} -- 要过滤的词 local list = config:get_list(env.name_space .. "/words") for i = 0, list.size - 1 do local word = list:get_value_at(i).value @@ -24,11 +24,11 @@ function M.func(input, env) local index = 0 for cand in input:iter() do index = index + 1 - -- 定位匹配的英文词 - if not string.find(cand.preedit, " ") and not string.match(cand.text, "%A") then - table.insert(pending_cands, cand) - else + -- 找到要降低的英文词,加入 pending_cands + if cand.preedit:find(" ") or not cand.text:match("^[%a']+$") then yield(cand) + else + table.insert(pending_cands, cand) end if index >= M.idx + #pending_cands - 1 then for _, cand in ipairs(pending_cands) do diff --git a/rime_ice.schema.yaml b/rime_ice.schema.yaml index 8e926b4..5550f47 100644 --- a/rime_ice.schema.yaml +++ b/rime_ice.schema.yaml @@ -98,7 +98,7 @@ reduce_english_filter: lux, moc, mos, mot, mum, nad, nay, nib, nip, pak, pap, pax, rig, rum, sac, sal, sax, sec, shin, sis, ska, slang, sus, tad, taj, tac, tic, yep, yum, fax, cain, key, mob, buy, dam, wap, yes, but, put, lag, buf, lip, aid, aim, dig, dim, din, - dip, pail, cad, chap, bend, lid, gem, tin, tum, my] + dip, pail, cad, chap, bend, lid, gem, tin, tum, my, went, youd, hes] # 主翻译器,拼音