This project provides:
- a lua binding for cppjieba
- a neovim plugin for Chinese w/b/e/ge.
- support count like
3w. - flexibility. A library is provided. Even you can realize a w/b/e/gw according to LLM's tokenize algorithm.
- better performance than pure lua.
- text object
iwanddw,cw, ...
- coc-ci: based on segmentit. Written in nodejs.
- jieba-lua: written in lua.
- jieba.vim: based on jieba-rs Written in python and rust.
- jieba_nvim: based on cppjieba. Written in C++. Stop maintenance. This project is a rewrite of it.
- deno-bridge-jieba: based on deno-jieba. Written in denojs use and wasm.
- vscode-jieba: based on jieba-rs. Written in rust and use wasm. Support Vim mode and Emacs mode.
:Rocks install cppjieba~/.config/nvim/rocks.toml:
[plugins]
"cppjieba" = "scm"Then
:Rocks syncor:
$ luarocks --lua-version 5.1 --local --tree ~/.local/share/nvim/rocks install cppjieba
# ~/.local/share/nvim/rocks is the default rocks tree path
# you can change it according to your vim.g.rocks_nvim.rocks_pathrequire("lazy").setup {
spec = {
{ "neo451/jieba.nvim", lazy = false },
},
}local Jieba = require "cppjieba.jieba".Jieba
local jieba = Jieba()
local tokens = jieba:cut "他来到了网易杭研大厦"
print(tokens[#tokens])
-- 大厦By default, it doesn't use any user dictionary. You can:
local Jieba = require "cppjieba.jieba".Jieba
local Motion = require "wordmotion.jieba".Motion
local motion = Motion {
jieba = Jieba {
paths = {
user_dict = "/the/path/of/my/user.dict.utf8"
}
}
}
motion:set_keymaps()HMM can provide higher precision. You can disable it by:
local motion = Motion {
jieba = Jieba {
hmm = false,
}
}