Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lua_filter@en_spacer bug #513

Closed
fastfading opened this issue Oct 13, 2023 · 2 comments
Closed

lua_filter@en_spacer bug #513

fastfading opened this issue Oct 13, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@fastfading
Copy link

bug
enabled
lua_filter@en_spacer

grep dont *
en_dicts/en.dict.yaml:don't dont

type dont
expect don't
actually don 't (add a space here)

@xtmu
Copy link
Contributor

xtmu commented Oct 13, 2023

没考虑到含有单引号的情况,我修改了匹配规则,更新一下 en_spacer.lua 文件:

-- 这个 Lua 给英文单词后面自动加一个空格 #496

local function add_space_to_english_word(input)
    -- 匹配纯英文单词(don't 算纯英文单词)并在单词后添加空格
    input = input:gsub("(%a+'?%a*)", "%1 ")

    return input
end

-- 在候选项上屏时触发的函数
function en_spacer(input, env)
    for cand in input:iter() do
        if cand.text:match("^[%a']+[%a']*$") then
            -- 如果候选项是纯英文单词,则在输入后添加一个空格
            cand = cand:to_shadow_candidate(cand.type, add_space_to_english_word(cand.text), cand.comment)
        end
        yield(cand)
    end
end

return en_spacer

@iDvel iDvel added enhancement New feature or request bug Something isn't working and removed enhancement New feature or request labels Oct 14, 2023
@iDvel iDvel closed this as completed in 8eef756 Oct 14, 2023
@fastfading
Copy link
Author

你没有验证这个bug ?
还是不对啊
你看我打出来的
有空格
didn 't
doesn 't

没自动联想
isnt
lets

sangjeedondrub added a commit to sangjeedondrub/rime-configuration that referenced this issue Nov 2, 2023
* github/main: (24 commits)
  dict: 完成同义多音字注音 close iDvel#353
  dict: 添加 "明不明显" (iDvel#529)
  feat: reduce_english_filter.lua 增加一键全降低
  fix: 完善所有双拼 i?ong 键位的正则
  dict: 日常更新
  fix: reduce_english_filter.lua 处理有空格的单词 iDvel#524
  conf: 双拼默认不启用简拼 iDvel#508
  dict: 日常更新 close iDvel#522
  feat: 英文方案增加 `#` jing 和 `+` jia 的派生
  dict: 日常更新 close iDvel#520
  fix: reduce_english_filter.lua 可识别含单引号的单词 close iDvel#519
  dict: 「皮妙」→「皮秒」 close iDvel#517
  dict: 日常更新 iDvel#457 close iDvel#516 添加一些英文缩写 close iDvel#512
  fix: en_spacer.lua 处理含单引号的单词 close iDvel#513
  conf: 双拼默认不启用简拼 iDvel#508
  fix: reduce_english_filter.lua 不处理非英文单词  fix iDvel#505
  dict: 日常更新; close iDvel#502
  feat: 完善九宫格
  dict: 日常更新; close iDvel#493
  feat: en_spacer.lua 英文词条上屏自动添加空格 (iDvel#496)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants