lua & docs: 增加 is_in_user_dict 配置项; close #279
This commit is contained in:
parent
a3af9f96ac
commit
05443240f6
@ -168,9 +168,6 @@ key_binder:
|
||||
# Lua 配置: 以词定字(上屏当前词句的第一个或最后一个字),和中括号翻页有冲突
|
||||
select_first_character: "bracketleft" # 左中括号 [
|
||||
select_last_character: "bracketright" # 右中括号 ]
|
||||
# Lua 配置: 词条隐藏、降频
|
||||
# turn_down_cand: "Control+j" # 匹配当前输入码后隐藏指定的候选字词 或候选词条放到第四候选位置
|
||||
# drop_cand: "Control+d" # 强制删词, 无视输入的编码
|
||||
|
||||
bindings:
|
||||
# Tab / Shift+Tab 切换光标至下/上一个拼音
|
||||
|
@ -51,8 +51,7 @@ switches:
|
||||
# 输入引擎
|
||||
engine:
|
||||
processors:
|
||||
- lua_processor@select_character # 以词定字
|
||||
# - lua_processor@cold_word_drop_processor # 词条隐藏、降频
|
||||
- lua_processor@select_character # 以词定字
|
||||
- ascii_composer
|
||||
- recognizer
|
||||
- key_binder
|
||||
@ -81,8 +80,6 @@ engine:
|
||||
- simplifier@traditionalize # 简繁切换
|
||||
- uniquifier # 去重
|
||||
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
||||
# - lua_filter@is_in_user_dict # 为用户词典中(输入过)的内容结尾加上一个星号
|
||||
# - lua_filter@cold_word_drop_filter # 词条隐藏、降频
|
||||
|
||||
|
||||
# Lua 配置: 日期、时间、星期、ISO 8601、时间戳的触发关键字
|
||||
|
@ -51,8 +51,7 @@ switches:
|
||||
# 输入引擎
|
||||
engine:
|
||||
processors:
|
||||
- lua_processor@select_character # 以词定字
|
||||
# - lua_processor@cold_word_drop_processor # 词条隐藏、降频
|
||||
- lua_processor@select_character # 以词定字
|
||||
- ascii_composer
|
||||
- recognizer
|
||||
- key_binder
|
||||
@ -81,8 +80,6 @@ engine:
|
||||
- simplifier@traditionalize # 简繁切换
|
||||
- uniquifier # 去重
|
||||
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
||||
# - lua_filter@is_in_user_dict # 为用户词典中(输入过)的内容结尾加上一个星号
|
||||
# - lua_filter@cold_word_drop_filter # 词条隐藏、降频
|
||||
|
||||
|
||||
# Lua 配置: 日期、时间、星期、ISO 8601、时间戳的触发关键字
|
||||
|
@ -51,8 +51,7 @@ switches:
|
||||
# 输入引擎
|
||||
engine:
|
||||
processors:
|
||||
- lua_processor@select_character # 以词定字
|
||||
# - lua_processor@cold_word_drop_processor # 词条隐藏、降频
|
||||
- lua_processor@select_character # 以词定字
|
||||
- ascii_composer
|
||||
- recognizer
|
||||
- key_binder
|
||||
@ -81,8 +80,6 @@ engine:
|
||||
- simplifier@traditionalize # 简繁切换
|
||||
- uniquifier # 去重
|
||||
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
||||
# - lua_filter@is_in_user_dict # 为用户词典中(输入过)的内容结尾加上一个星号
|
||||
# - lua_filter@cold_word_drop_filter # 词条隐藏、降频
|
||||
|
||||
|
||||
# Lua 配置: 日期、时间、星期、ISO 8601、时间戳的触发关键字
|
||||
|
@ -51,8 +51,7 @@ switches:
|
||||
# 输入引擎
|
||||
engine:
|
||||
processors:
|
||||
- lua_processor@select_character # 以词定字
|
||||
# - lua_processor@cold_word_drop_processor # 词条隐藏、降频
|
||||
- lua_processor@select_character # 以词定字
|
||||
- ascii_composer
|
||||
- recognizer
|
||||
- key_binder
|
||||
@ -81,8 +80,6 @@ engine:
|
||||
- simplifier@traditionalize # 简繁切换
|
||||
- uniquifier # 去重
|
||||
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
||||
# - lua_filter@is_in_user_dict # 为用户词典中(输入过)的内容结尾加上一个星号
|
||||
# - lua_filter@cold_word_drop_filter # 词条隐藏、降频
|
||||
|
||||
|
||||
# Lua 配置: 日期、时间、星期、ISO 8601、时间戳的触发关键字
|
||||
|
@ -1,8 +1,21 @@
|
||||
-- 为用户词典中(输入过)的内容结尾加上一个星号 *
|
||||
-- 根据是否在用户词典,在结尾加上一个星号 *
|
||||
-- is_in_user_dict: true 输入过的内容
|
||||
-- is_in_user_dict: flase 或不写 未输入过的内容
|
||||
local function is_in_user_dict(input, env)
|
||||
if not env.is_in_user_dict then
|
||||
local config = env.engine.schema.config
|
||||
env.name_space = env.name_space:gsub('^*', '')
|
||||
env.is_in_user_dict = config:get_bool(env.name_space)
|
||||
end
|
||||
for cand in input:iter() do
|
||||
if (string.find(cand.type, "user")) then
|
||||
cand.comment = cand.comment .. '*'
|
||||
if env.is_in_user_dict then
|
||||
if (string.find(cand.type, "user")) then
|
||||
cand.comment = cand.comment .. '*'
|
||||
end
|
||||
else
|
||||
if not (string.find(cand.type, "user")) then
|
||||
cand.comment = cand.comment .. '*'
|
||||
end
|
||||
end
|
||||
yield(cand)
|
||||
end
|
||||
|
22
rime.lua
22
rime.lua
@ -25,12 +25,28 @@ unicode = require("unicode")
|
||||
-- 数字、人民币大写,R 开头
|
||||
number_translator = require("number_translator")
|
||||
|
||||
-- 九宫格,手机用,未写入。
|
||||
|
||||
|
||||
|
||||
|
||||
-- 默认未启用:
|
||||
|
||||
-- 九宫格,手机用。
|
||||
-- 在 engine/filters 增加 - lua_filter@t9_preedit
|
||||
t9_preedit = require("t9_preedit")
|
||||
|
||||
-- 为用户词典中(输入过)的内容结尾加上一个星号,默认未启用。
|
||||
-- 根据是否在用户词典,在结尾加上一个星号 *
|
||||
-- 在 engine/filters 增加 - lua_filter@is_in_user_dict
|
||||
-- 在方案里写配置项:
|
||||
-- is_in_user_dict: true 为输入过的内容加星号
|
||||
-- is_in_user_dict: flase 为未输入过的内容加星号
|
||||
is_in_user_dict = require("is_in_user_dict")
|
||||
|
||||
-- 词条隐藏、降频,默认未启用。
|
||||
-- 词条隐藏、降频
|
||||
-- 在 engine/processors 增加 - lua_processor@cold_word_drop_processor
|
||||
-- 在 engine/filters 增加 - lua_filter@cold_word_drop_filter
|
||||
-- 在 key_binder 增加快捷键:
|
||||
-- turn_down_cand: "Control+j" # 匹配当前输入码后隐藏指定的候选字词 或候选词条放到第四候选位置
|
||||
-- drop_cand: "Control+d" # 强制删词, 无视输入的编码
|
||||
cold_word_drop_processor = require("cold_word_drop.processor")
|
||||
cold_word_drop_filter = require("cold_word_drop.filter")
|
||||
|
@ -42,8 +42,7 @@ switches:
|
||||
# 输入引擎
|
||||
engine:
|
||||
processors:
|
||||
- lua_processor@select_character # 以词定字
|
||||
# - lua_processor@cold_word_drop_processor # 词条隐藏、降频
|
||||
- lua_processor@select_character # 以词定字
|
||||
- ascii_composer
|
||||
- recognizer
|
||||
- key_binder
|
||||
@ -71,8 +70,6 @@ engine:
|
||||
- simplifier@emoji # Emoji
|
||||
- simplifier@traditionalize # 简繁切换
|
||||
- uniquifier # 去重
|
||||
# - lua_filter@is_in_user_dict # 为用户词典中(输入过)的内容结尾加上一个星号
|
||||
# - lua_filter@cold_word_drop_filter # 词条隐藏、降频
|
||||
- lua_filter@v_filter # v 模式 symbols 优先(否则是英文优先)
|
||||
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
|
||||
- lua_filter@long_word_filter # 长词优先
|
||||
|
Loading…
Reference in New Issue
Block a user