conf: 调整 filters 排序
This commit is contained in:
parent
0bff604e9b
commit
a7c5fac2e4
@ -83,12 +83,12 @@ engine:
|
|||||||
- lua_translator@force_gc # 暴力 GC
|
- lua_translator@force_gc # 暴力 GC
|
||||||
filters:
|
filters:
|
||||||
- lua_filter@corrector # 错音错字提示
|
- lua_filter@corrector # 错音错字提示
|
||||||
- lua_filter@pin_cand_filter # 置顶候选项
|
|
||||||
- simplifier@emoji # Emoji
|
|
||||||
- simplifier@traditionalize # 简繁切换
|
|
||||||
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
|
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
|
||||||
- lua_filter@search@radical_pinyin # 部件拆字辅码
|
- lua_filter@search@radical_pinyin # 部件拆字辅码
|
||||||
- lua_filter@autocap_filter # 英文自动大写
|
- lua_filter@autocap_filter # 英文自动大写
|
||||||
|
- lua_filter@pin_cand_filter # 置顶候选项(顺序要求:置顶候选项 > Emoji > 简繁切换)
|
||||||
|
- simplifier@emoji # Emoji
|
||||||
|
- simplifier@traditionalize # 简繁切换
|
||||||
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
||||||
- uniquifier # 去重
|
- uniquifier # 去重
|
||||||
|
|
||||||
|
@ -83,12 +83,12 @@ engine:
|
|||||||
- lua_translator@force_gc # 暴力 GC
|
- lua_translator@force_gc # 暴力 GC
|
||||||
filters:
|
filters:
|
||||||
- lua_filter@corrector # 错音错字提示
|
- lua_filter@corrector # 错音错字提示
|
||||||
- lua_filter@pin_cand_filter # 置顶候选项
|
|
||||||
- simplifier@emoji # Emoji
|
|
||||||
- simplifier@traditionalize # 简繁切换
|
|
||||||
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
|
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
|
||||||
- lua_filter@search@radical_pinyin # 部件拆字辅码
|
- lua_filter@search@radical_pinyin # 部件拆字辅码
|
||||||
- lua_filter@autocap_filter # 英文自动大写
|
- lua_filter@autocap_filter # 英文自动大写
|
||||||
|
- lua_filter@pin_cand_filter # 置顶候选项(顺序要求:置顶候选项 > Emoji > 简繁切换)
|
||||||
|
- simplifier@emoji # Emoji
|
||||||
|
- simplifier@traditionalize # 简繁切换
|
||||||
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
||||||
- uniquifier # 去重
|
- uniquifier # 去重
|
||||||
|
|
||||||
|
@ -83,12 +83,12 @@ engine:
|
|||||||
- lua_translator@force_gc # 暴力 GC
|
- lua_translator@force_gc # 暴力 GC
|
||||||
filters:
|
filters:
|
||||||
- lua_filter@corrector # 错音错字提示
|
- lua_filter@corrector # 错音错字提示
|
||||||
- lua_filter@pin_cand_filter # 置顶候选项
|
|
||||||
- simplifier@emoji # Emoji
|
|
||||||
- simplifier@traditionalize # 简繁切换
|
|
||||||
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
|
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
|
||||||
- lua_filter@search@radical_pinyin # 部件拆字辅码
|
- lua_filter@search@radical_pinyin # 部件拆字辅码
|
||||||
- lua_filter@autocap_filter # 英文自动大写
|
- lua_filter@autocap_filter # 英文自动大写
|
||||||
|
- lua_filter@pin_cand_filter # 置顶候选项(顺序要求:置顶候选项 > Emoji > 简繁切换)
|
||||||
|
- simplifier@emoji # Emoji
|
||||||
|
- simplifier@traditionalize # 简繁切换
|
||||||
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
||||||
- uniquifier # 去重
|
- uniquifier # 去重
|
||||||
|
|
||||||
|
@ -83,12 +83,12 @@ engine:
|
|||||||
- lua_translator@force_gc # 暴力 GC
|
- lua_translator@force_gc # 暴力 GC
|
||||||
filters:
|
filters:
|
||||||
- lua_filter@corrector # 错音错字提示
|
- lua_filter@corrector # 错音错字提示
|
||||||
- lua_filter@pin_cand_filter # 置顶候选项
|
|
||||||
- simplifier@emoji # Emoji
|
|
||||||
- simplifier@traditionalize # 简繁切换
|
|
||||||
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
|
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
|
||||||
- lua_filter@search@radical_pinyin # 部件拆字辅码
|
- lua_filter@search@radical_pinyin # 部件拆字辅码
|
||||||
- lua_filter@autocap_filter # 英文自动大写
|
- lua_filter@autocap_filter # 英文自动大写
|
||||||
|
- lua_filter@pin_cand_filter # 置顶候选项(顺序要求:置顶候选项 > Emoji > 简繁切换)
|
||||||
|
- simplifier@emoji # Emoji
|
||||||
|
- simplifier@traditionalize # 简繁切换
|
||||||
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
||||||
- uniquifier # 去重
|
- uniquifier # 去重
|
||||||
|
|
||||||
|
@ -83,12 +83,12 @@ engine:
|
|||||||
- lua_translator@force_gc # 暴力 GC
|
- lua_translator@force_gc # 暴力 GC
|
||||||
filters:
|
filters:
|
||||||
- lua_filter@corrector # 错音错字提示
|
- lua_filter@corrector # 错音错字提示
|
||||||
- lua_filter@pin_cand_filter # 置顶候选项
|
|
||||||
- simplifier@emoji # Emoji
|
|
||||||
- simplifier@traditionalize # 简繁切换
|
|
||||||
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
|
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
|
||||||
- lua_filter@search@radical_pinyin # 部件拆字辅码
|
- lua_filter@search@radical_pinyin # 部件拆字辅码
|
||||||
- lua_filter@autocap_filter # 英文自动大写
|
- lua_filter@autocap_filter # 英文自动大写
|
||||||
|
- lua_filter@pin_cand_filter # 置顶候选项(顺序要求:置顶候选项 > Emoji > 简繁切换)
|
||||||
|
- simplifier@emoji # Emoji
|
||||||
|
- simplifier@traditionalize # 简繁切换
|
||||||
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
||||||
- uniquifier # 去重
|
- uniquifier # 去重
|
||||||
|
|
||||||
|
@ -83,12 +83,12 @@ engine:
|
|||||||
- lua_translator@force_gc # 暴力 GC
|
- lua_translator@force_gc # 暴力 GC
|
||||||
filters:
|
filters:
|
||||||
- lua_filter@corrector # 错音错字提示
|
- lua_filter@corrector # 错音错字提示
|
||||||
- lua_filter@pin_cand_filter # 置顶候选项
|
|
||||||
- simplifier@emoji # Emoji
|
|
||||||
- simplifier@traditionalize # 简繁切换
|
|
||||||
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
|
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
|
||||||
- lua_filter@search@radical_pinyin # 部件拆字辅码
|
- lua_filter@search@radical_pinyin # 部件拆字辅码
|
||||||
- lua_filter@autocap_filter # 英文自动大写
|
- lua_filter@autocap_filter # 英文自动大写
|
||||||
|
- lua_filter@pin_cand_filter # 置顶候选项(顺序要求:置顶候选项 > Emoji > 简繁切换)
|
||||||
|
- simplifier@emoji # Emoji
|
||||||
|
- simplifier@traditionalize # 简繁切换
|
||||||
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
||||||
- uniquifier # 去重
|
- uniquifier # 去重
|
||||||
|
|
||||||
|
@ -1,36 +1,7 @@
|
|||||||
-- 长词优先(提升「西安」「提案」「图案」「饥饿」等词汇的优先级)
|
-- 长词优先(提升「西安」「提案」「图案」「饥饿」等词汇的优先级)
|
||||||
-- 感谢&参考于: https://github.com/tumuyan/rime-melt
|
-- 感谢&参考于: https://github.com/tumuyan/rime-melt
|
||||||
-- 不提升包含英文、数字、emoji、假名的候选项
|
-- 不提升包含英文、数字的候选项
|
||||||
|
-- 不提升包含 emoji、假名的候选项(通过将此 Lua 放到 simplifier@emoji 前面来实现)
|
||||||
local function isEmoji(text)
|
|
||||||
for _, char in utf8.codes(text) do
|
|
||||||
if (char >= 0x1F600 and char <= 0x1F64F) or -- Emoticons
|
|
||||||
(char >= 0x1F300 and char <= 0x1F5FF) or -- Misc Symbols and Pictographs
|
|
||||||
(char >= 0x1F680 and char <= 0x1F6FF) or -- Transport and Map
|
|
||||||
(char >= 0x2600 and char <= 0x26FF) or -- Misc symbols
|
|
||||||
(char >= 0x2700 and char <= 0x27BF) or -- Dingbats
|
|
||||||
(char >= 0xFE00 and char <= 0xFE0F) or -- Variation Selectors
|
|
||||||
(char >= 0x1F900 and char <= 0x1F9FF) or -- Supplemental Symbols and Pictographs
|
|
||||||
(char >= 0x1F1E6 and char <= 0x1F1FF) then -- Flags (iOS)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
local function containsJapaneseKana(str)
|
|
||||||
for _, code in utf8.codes(str) do
|
|
||||||
-- 检查平假名的 Unicode 范围(0x3040 至 0x309F)
|
|
||||||
if code >= 0x3040 and code <= 0x309F then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
-- 检查片假名的 Unicode 范围(0x30A0 至 0x30FF)
|
|
||||||
if code >= 0x30A0 and code <= 0x30FF then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
@ -58,7 +29,7 @@ function M.func(input)
|
|||||||
i = i + 1
|
i = i + 1
|
||||||
yield(cand)
|
yield(cand)
|
||||||
-- 长词直接 yield,其余的放到 l 里
|
-- 长词直接 yield,其余的放到 l 里
|
||||||
elseif leng <= firstWordLength or cand.text:find("[%a%d]") or containsJapaneseKana(cand.text) or isEmoji(cand.text) then
|
elseif leng <= firstWordLength or cand.text:find("[%a%d]") then
|
||||||
table.insert(l, cand)
|
table.insert(l, cand)
|
||||||
else
|
else
|
||||||
yield(cand)
|
yield(cand)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
schema:
|
schema:
|
||||||
schema_id: rime_ice
|
schema_id: rime_ice
|
||||||
name: 雾凇拼音
|
name: 雾凇拼音
|
||||||
version: "2024-02-09"
|
version: "2024-02-11"
|
||||||
author:
|
author:
|
||||||
- Dvel
|
- Dvel
|
||||||
description: |
|
description: |
|
||||||
@ -72,15 +72,15 @@ engine:
|
|||||||
- lua_translator@force_gc # 暴力 GC
|
- lua_translator@force_gc # 暴力 GC
|
||||||
filters:
|
filters:
|
||||||
- lua_filter@corrector # 错音错字提示
|
- lua_filter@corrector # 错音错字提示
|
||||||
- lua_filter@pin_cand_filter # 置顶候选项(顺序要求:置顶候选项 > Emoji > 简繁切换)
|
|
||||||
- simplifier@emoji # Emoji
|
|
||||||
- simplifier@traditionalize # 简繁切换
|
|
||||||
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
|
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
|
||||||
- lua_filter@search@radical_pinyin # 部件拆字辅码
|
- lua_filter@search@radical_pinyin # 部件拆字辅码
|
||||||
- lua_filter@v_filter # v 模式 symbols 优先(否则是英文优先)
|
|
||||||
- lua_filter@autocap_filter # 英文自动大写
|
- lua_filter@autocap_filter # 英文自动大写
|
||||||
|
- lua_filter@v_filter # v 模式 symbols 优先
|
||||||
|
- lua_filter@pin_cand_filter # 置顶候选项(顺序要求:置顶候选项 > Emoji > 简繁切换)
|
||||||
|
- lua_filter@long_word_filter # 长词优先(顺序要求:长词优先 > Emoji)
|
||||||
|
- simplifier@emoji # Emoji
|
||||||
|
- simplifier@traditionalize # 简繁切换
|
||||||
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
||||||
- lua_filter@long_word_filter # 长词优先
|
|
||||||
- uniquifier # 去重
|
- uniquifier # 去重
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user