You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
local str1={
abcd="A.\nB.\nC.\nD.",
efg="E\nF\nG"
}
local function multi_line(input, seg)
for k, v in pairs(str1) do
if (input == k) then
yield(Candidate("multi", seg.start, seg._end, v , "*"))
end
end
end
return multi_line
但是,我不想把词条写插件里,而是写在dict.yaml里。于是我就用filter,这样写:
local function duohang(input,env,seg)
for cand in input:iter() do
if string.find(cand.text, "\\n" ) then
local str1 = string.gsub(cand.text, "\\n","\n")
yield(Candidate("c",seg.start,seg._end,str1,"*"))
return
else
yield(cand)
end
end
end
return duohang
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
我用的是五笔。
首先,使用translator能实现。
但是,我不想把词条写插件里,而是写在dict.yaml里。于是我就用filter,这样写:
结果不行,当我输出带有
\n
的词条时,它和它后面的词条全都不显示,其它词条倒没被影响。请教该如何修改?
Beta Was this translation helpful? Give feedback.
All reactions