Skip to content

Commit

Permalink
fix: reduce_english_filter.lua 可识别含单引号的单词 close #519
Browse files Browse the repository at this point in the history
  • Loading branch information
iDvel committed Oct 16, 2023
1 parent 649f493 commit a219451
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion double_pinyin.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]


# 主翻译器,拼音
Expand Down
2 changes: 1 addition & 1 deletion double_pinyin_abc.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]


# 主翻译器,拼音
Expand Down
2 changes: 1 addition & 1 deletion double_pinyin_flypy.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]


# 主翻译器,拼音
Expand Down
2 changes: 1 addition & 1 deletion double_pinyin_mspy.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]


# 主翻译器,拼音
Expand Down
2 changes: 1 addition & 1 deletion double_pinyin_sogou.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]


# 主翻译器,拼音
Expand Down
2 changes: 1 addition & 1 deletion double_pinyin_ziguang.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]


# 主翻译器,拼音
Expand Down
10 changes: 5 additions & 5 deletions lua/reduce_english_filter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rime_ice.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]


# 主翻译器,拼音
Expand Down

0 comments on commit a219451

Please sign in to comment.