fix: 当'作为分隔符又与it's重合,不在插入空格导致其分开

This commit is contained in:
amzxyz
2026-01-10 18:05:14 +08:00
parent 126009e07b
commit 94639c1e5e
2 changed files with 60 additions and 2 deletions

View File

@@ -153,6 +153,19 @@ local function restore_sentence_spacing(cand, split_pattern, check_pattern)
end
local new_text = table.concat(parts, " ")
local new_text = ""
for i, part in ipairs(parts) do
if i == 1 then
new_text = part
else
local last_char = sub(new_text, -1)
if last_char == "'" or last_char == "-" then
new_text = new_text .. part
else
new_text = new_text .. " " .. part
end
end
end
new_text = gsub(new_text, "%s%s+", " ")
if new_text == "" then return cand end