Go 语言高效分词, 支持英文、中文、日文等
词典用双数组 trie(Double-Array Trie)实现, 分词器算法为基于词频的最短路径加动态规划。v0.30.0 版本主要新增了 DAG 和 HMM (Viterbi) 算法分词, 新增 API 基本和结巴分词保持一致.
支持普通、搜索引擎、全模式、精确模式和 HMM模式多种分词模式,支持用户词典、词性标注,可运行JSON RPC服务。
更新详情和项目地址: gse
package mainimport ( "fmt" "github.com/go-ego/gse") func main() { var seg gse.Segmenter seg.LoadDict() text1 := "你好世界, Hello world" fmt.Println(seg.Cut(text1, true)) }
Rhine River
Add
[NEW] Add HMM cut support
[NEW] Add go mod support and remove dep files
[NEW] Add find word in dictionary func
[NEW] Add Cut(), CutAll(), CutSearch(), LoadModel(), HMMCut() func
[NEW] Add hmm cut test code
[NEW] Add hmm cut example code
Update
[NEW] Cutting the dict method, move load dictionary to dict_util.go
[NEW] Update example and Add more test
[NEW] Update and clean utils code
[NEW] Simplify test code, add equal benchmark code
[NEW] Update pkg cedar code
[NEW] Update code style
[NEW] Update README.md [ Format README.mdand Update example ]
Fix
[FIX] Fixed and clean issue template
[FIX] Update README.md [ update and fixed example ]
See Commits for more details, after Oct 9.