mirror of
https://github.com/iDvel/rime-ice.git
synced 2026-04-25 07:24:41 +00:00
fix: reduce_english_filter.lua 可识别含单引号的单词 close #519
This commit is contained in:
@@ -108,7 +108,7 @@ reduce_english_filter:
|
|||||||
lux, moc, mos, mot, mum, nad, nay, nib, nip, pak, pap, pax, rig, rum, sac, sal,
|
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,
|
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,
|
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]
|
||||||
|
|
||||||
|
|
||||||
# 主翻译器,拼音
|
# 主翻译器,拼音
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ reduce_english_filter:
|
|||||||
lux, moc, mos, mot, mum, nad, nay, nib, nip, pak, pap, pax, rig, rum, sac, sal,
|
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,
|
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,
|
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]
|
||||||
|
|
||||||
|
|
||||||
# 主翻译器,拼音
|
# 主翻译器,拼音
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ reduce_english_filter:
|
|||||||
lux, moc, mos, mot, mum, nad, nay, nib, nip, pak, pap, pax, rig, rum, sac, sal,
|
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,
|
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,
|
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]
|
||||||
|
|
||||||
|
|
||||||
# 主翻译器,拼音
|
# 主翻译器,拼音
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ reduce_english_filter:
|
|||||||
lux, moc, mos, mot, mum, nad, nay, nib, nip, pak, pap, pax, rig, rum, sac, sal,
|
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,
|
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,
|
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]
|
||||||
|
|
||||||
|
|
||||||
# 主翻译器,拼音
|
# 主翻译器,拼音
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ reduce_english_filter:
|
|||||||
lux, moc, mos, mot, mum, nad, nay, nib, nip, pak, pap, pax, rig, rum, sac, sal,
|
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,
|
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,
|
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]
|
||||||
|
|
||||||
|
|
||||||
# 主翻译器,拼音
|
# 主翻译器,拼音
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ reduce_english_filter:
|
|||||||
lux, moc, mos, mot, mum, nad, nay, nib, nip, pak, pap, pax, rig, rum, sac, sal,
|
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,
|
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,
|
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]
|
||||||
|
|
||||||
|
|
||||||
# 主翻译器,拼音
|
# 主翻译器,拼音
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ function M.init(env)
|
|||||||
local config = env.engine.schema.config
|
local config = env.engine.schema.config
|
||||||
env.name_space = env.name_space:gsub("^*", "")
|
env.name_space = env.name_space:gsub("^*", "")
|
||||||
M.idx = config:get_int(env.name_space .. "/idx") -- 要插入的位置
|
M.idx = config:get_int(env.name_space .. "/idx") -- 要插入的位置
|
||||||
M.words = {} -- 要过滤的词
|
M.words = {} -- 要过滤的词
|
||||||
local list = config:get_list(env.name_space .. "/words")
|
local list = config:get_list(env.name_space .. "/words")
|
||||||
for i = 0, list.size - 1 do
|
for i = 0, list.size - 1 do
|
||||||
local word = list:get_value_at(i).value
|
local word = list:get_value_at(i).value
|
||||||
@@ -24,11 +24,11 @@ function M.func(input, env)
|
|||||||
local index = 0
|
local index = 0
|
||||||
for cand in input:iter() do
|
for cand in input:iter() do
|
||||||
index = index + 1
|
index = index + 1
|
||||||
-- 定位匹配的英文词
|
-- 找到要降低的英文词,加入 pending_cands
|
||||||
if not string.find(cand.preedit, " ") and not string.match(cand.text, "%A") then
|
if cand.preedit:find(" ") or not cand.text:match("^[%a']+$") then
|
||||||
table.insert(pending_cands, cand)
|
|
||||||
else
|
|
||||||
yield(cand)
|
yield(cand)
|
||||||
|
else
|
||||||
|
table.insert(pending_cands, cand)
|
||||||
end
|
end
|
||||||
if index >= M.idx + #pending_cands - 1 then
|
if index >= M.idx + #pending_cands - 1 then
|
||||||
for _, cand in ipairs(pending_cands) do
|
for _, cand in ipairs(pending_cands) do
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ reduce_english_filter:
|
|||||||
lux, moc, mos, mot, mum, nad, nay, nib, nip, pak, pap, pax, rig, rum, sac, sal,
|
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,
|
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,
|
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]
|
||||||
|
|
||||||
|
|
||||||
# 主翻译器,拼音
|
# 主翻译器,拼音
|
||||||
|
|||||||
Reference in New Issue
Block a user