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

add wordninja_lua module #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

shewer
Copy link

@shewer shewer commented Jan 30, 2022

Signed-off-by: Shewer Lu shewer@gmail.com
從 shell調用wordninja 非常浪費 因爲 每次都要載入 wordninja_words.txt 且 重算權重

建議

  • wordninja.so 放在lua/ 下 可用下面function 加入 cpath
    可以不用user 再設定 so路逕
  • 提供 wordninja-lua 不用再從shell調用 py
  • require wordninja-rs-lua 失敗是否可以載入 wordninja-lua?
  • 可否再提供 wordninja-rs-lua lua5.4 dll
-- <user_data_dir>/lua/plugin/?.(so|dylib|dll) 加入 package.cpath
local function init_cpath()
  local path= ("./lua/plugin/"):gsub("/",package.config:sub(1,1) )
  local pattern = path:gsub("([.?/%\\])","%%%1")
  --  pattern --> "%.%/lua%/plugin%/"  or "%.%\\lua%\\plugin%\\"
  if not package.cpath:match( pattern ) then
    local cp=package.cpath
    local df= cp:match('?.so') or cp:match('?.dylib') or cp:match('?.dll')
    package.cpath= package.cpath .. (df and ";" .. path .. df or "")
  end
end

Signed-off-by: Shewer Lu <shewer@gmail.com>
Signed-off-by: Shewer Lu <shewer@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant