2023-05-21 04:59:21 +02:00
|
|
|
-- 根据是否在用户词典,在结尾加上一个星号 *
|
|
|
|
-- is_in_user_dict: true 输入过的内容
|
2023-12-13 11:23:20 +01:00
|
|
|
-- is_in_user_dict: false 或不写 未输入过的内容
|
2023-06-15 16:21:06 +02:00
|
|
|
|
|
|
|
local M = {}
|
|
|
|
|
|
|
|
function M.init(env)
|
|
|
|
local config = env.engine.schema.config
|
|
|
|
env.name_space = env.name_space:gsub('^*', '')
|
2024-05-16 11:43:54 +02:00
|
|
|
M.is_in_user_dict = config:get_bool(env.name_space) or nil
|
2023-06-15 16:21:06 +02:00
|
|
|
end
|
|
|
|
|
2024-03-17 16:32:11 +01:00
|
|
|
local is_user = {
|
|
|
|
user_table = true,
|
|
|
|
user_phrase = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
function M.func(input)
|
2023-05-04 19:41:21 +02:00
|
|
|
for cand in input:iter() do
|
2024-05-16 11:43:54 +02:00
|
|
|
if is_user[cand.type] == M.is_in_user_dict then
|
2024-03-17 16:32:11 +01:00
|
|
|
cand.comment = cand.comment .. '*'
|
2023-05-04 19:41:21 +02:00
|
|
|
end
|
|
|
|
yield(cand)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-06-15 16:21:06 +02:00
|
|
|
return M
|