fix: reduce_english_filter.lua 只要 cand.text 包含英文就处理 close #558

This commit is contained in:
Dvel 2023-11-28 17:44:57 +08:00
parent b56953bd88
commit fdd5fbce0e

View File

@ -42,7 +42,10 @@ function M.init(env)
"tan", "tang", "tank", "tap", "tar", "tax", "tec", "ted", "tel", "ten", "ter", "tex", "tic", "tied", "tier", "tan", "tang", "tank", "tap", "tar", "tax", "tec", "ted", "tel", "ten", "ter", "tex", "tic", "tied", "tier",
"ties", "tim", "tin", "tip", "tit", "tour", "tout", "tum", "wag", "wait", "wail", "wan", "wand", "womens", "ties", "tim", "tin", "tip", "tit", "tour", "tout", "tum", "wag", "wait", "wail", "wan", "wand", "womens",
"want", "wap", "war", "was", "wax", "way", "weir", "went", "won", "wow", "yan", "yang", "yen", "yep", "yes", "want", "wap", "war", "was", "wax", "way", "weir", "went", "won", "wow", "yan", "yang", "yen", "yep", "yes",
"yet", "yin", "your", "yum", "zen", "zip" } "yet", "yin", "your", "yum", "zen", "zip",
-- 下面是大于 4 位的
"quanx",
}
M.all = {} M.all = {}
for _, v in ipairs(all) do for _, v in ipairs(all) do
M.all[v] = true M.all[v] = true
@ -76,7 +79,7 @@ function M.func(input, env)
for cand in input:iter() do for cand in input:iter() do
index = index + 1 index = index + 1
-- 找到要降低的英文词,加入 pending_cands -- 找到要降低的英文词,加入 pending_cands
if cand.preedit:find(" ") or not cand.text:match("^[%a' ]+$") then if cand.preedit:find(" ") or not cand.text:match("[a-zA-Z]") then
yield(cand) yield(cand)
else else
table.insert(pending_cands, cand) table.insert(pending_cands, cand)