first commit

This commit is contained in:
CrazyJasonwell
2025-04-19 20:17:58 +08:00
parent 5f74e622ed
commit 97fbdf0277
416 changed files with 4030739 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,30 @@
--- 过滤器:最长词组和单字在先
local function long_phrase_first(input)
local l = {}
local s = {}
local c = {}
local max = 1
for cand in input:iter() do
if (utf8.len(cand.text) > max) then
max = utf8.len(cand.text)
end
if (utf8.len(cand.text) == 1) then
table.insert(c, cand)
elseif (utf8.len(cand.text) < max) then
table.insert(s, cand)
else
table.insert(l, cand)
end
end
for i, cand in ipairs(l) do
yield(cand)
end
for i, cand in ipairs(c) do
yield(cand)
end
for i, cand in ipairs(s) do
yield(cand)
end
end
return long_phrase_first

View File

@@ -0,0 +1,16 @@
--- 过滤器:单字在先
local function single_char_first(input)
local l = {}
for cand in input:iter() do
if (utf8.len(cand.text) == 1) then
yield(cand)
else
table.insert(l, cand)
end
end
for i, cand in ipairs(l) do
yield(cand)
end
end
return single_char_first

View File

@@ -0,0 +1,10 @@
--- 过滤器:只显示单字
local function single_char_only(input)
for cand in input:iter() do
if (utf8.len(cand.text) == 1) then
yield(cand)
end
end
end
return single_char_only