From 1bf833660c78ee9e7b239860c6e827a474cab71d Mon Sep 17 00:00:00 2001 From: amzxyz Date: Thu, 25 Dec 2025 20:44:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=8C=E5=96=84=E5=85=A8=E6=8B=BC?= =?UTF-8?q?=E5=8F=8D=E6=9F=A5=E8=BE=85=E7=AD=9B=E6=A8=A1=E5=BC=8F=E4=B8=8B?= =?UTF-8?q?=EF=BC=8C=E4=B8=A4=E5=88=86=E9=A6=96=E5=AD=97=E6=AF=8D(?= =?UTF-8?q?=E5=A3=B0=E6=AF=8D)=E7=9A=84=E6=8F=90=E5=8F=96=E7=AD=96?= =?UTF-8?q?=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dicts/jichu.dict.yaml | 12 +++++++----- lua/super_lookup.lua | 41 +++++++++++++++++++++++++---------------- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/dicts/jichu.dict.yaml b/dicts/jichu.dict.yaml index 2bf6168..3e40a75 100644 --- a/dicts/jichu.dict.yaml +++ b/dicts/jichu.dict.yaml @@ -218967,7 +218967,7 @@ sort: by_weight 不想上 bù xiǎng shàng 192 不想烧 bù xiǎng shāo 135 不想生 bù xiǎng shēng 190 -不像是 bú xiàng shì 348 +不像是 bú xiàng shì 448 不相识 bù xiāng shí 348 不想事 bù xiǎng shì 116 不享受 bù xiǎng shòu 288 @@ -414366,11 +414366,11 @@ sort: by_weight 健一网 jiàn yī wǎng 106 菅义伟 jiān yì wěi 238 建议我 jiàn yì wǒ 294 -建议下 jiàn yì xià 280 -剪一下 jiǎn yí xià 173 -见一下 jiàn yí xià 166 +见一下 jiàn yí xià 366 +剪一下 jiǎn yí xià 273 +煎一下 jiān yí xià 260 +捡一下 jiǎn yí xià 234 减一下 jiǎn yí xià 158 -捡一下 jiǎn yí xià 64 建议先 jiàn yì xiān 290 煎一些 jiān yì xiē 40 减一些 jiǎn yì xiē 38 @@ -604168,6 +604168,8 @@ sort: by_weight 升级点 shēng jí diǎn 162 生肌法 shēng jī fǎ 100 生肌膏 shēng jī gāo 79 +剩几个 shèng jǐ gè 510 +生几个 shēng jǐ gè 209 省机关 shěng jī guān 115 升级过 shēng jí guò 149 升记号 shēng jì hào 96 diff --git a/lua/super_lookup.lua b/lua/super_lookup.lua index a4e71d5..3f6cbff 100644 --- a/lua/super_lookup.lua +++ b/lua/super_lookup.lua @@ -58,26 +58,35 @@ end local function expand_code_variant(main_projection, xlit_projection, part) local out, seen = {}, {} local function add(s) if s and #s > 0 and not seen[s] then seen[s] = true out[#out + 1] = s end end - add(part) - if main_projection then local p = main_projection:apply(part, true) if p and #p > 0 then add(p) end end - local base = {} - for i = 1, #out do local elem = out[i] if elem:match('^%l+$') then base[#base + 1] = elem end end - - -- 提取 1,3 位生成构造码 - for _, s in ipairs(base) do - -- 安全检查:确保长度足够 - if #s >= 3 and #s <= 4 and s:match('^%l+$') then - add(s:sub(1,1) .. s:sub(3,3)) - end - end - if part:match('^%u+$') and xlit_projection then - local xlit_result = xlit_projection:apply(part, true) - if xlit_result and #xlit_result > 0 then add(xlit_result) end + -- 1. 定义“种子”列表,首先放入原始编码 part + local seeds = { part } + + -- 2. 提取只有一个单引号编码,若成功则将其作为第二个“种子”加入列表 + -- 例如:part="ce'shi",提取出 "cs" 加入 seeds + local _, quote_count = part:gsub("'", "") + if quote_count == 1 then + local s1, s2 = part:match("^([^']*)'([^']*)$") + if s1 and s2 and #s1 > 0 and #s2 > 0 then + local derived_code = s1:sub(1,1) .. s2:sub(1,1) + table.insert(seeds, derived_code) + end + end + -- 3. 遍历所有种子(原始编码 + 缩写编码),统一进行规则投影 + for _, code in ipairs(seeds) do + -- 应用 main_projection (非大写) + if main_projection then + local p = main_projection:apply(code, true) + if p and #p > 0 then add(p) end + end + -- 应用 xlit_projection (大写笔画,不参与前面重复计算) + if code:match('^%u+$') and xlit_projection then + local xlit_result = xlit_projection:apply(code, true) + if xlit_result and #xlit_result > 0 then add(xlit_result) end + end end return out end - -- 【DB】查表 local function build_reverse_group(main_projection, xlit_projection, db_table, text) local group, seen = {}, {}