1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-06-13 05:31:02 +08:00

use github.com/deckarep/golang-set instead of Trie, to reduce memory usage and improve performance, this is corresponding to jieba commit #4a93f21918a26083c039970edb9457c589c3a0ab

This commit is contained in:
Wang Bin
2015-02-03 15:20:30 +08:00
parent 9b2e9d29df
commit 9ee7ba2c13
3 changed files with 70 additions and 96 deletions

View File

@@ -24,7 +24,7 @@ func Tokenize(sentence string, mode string, HMM bool) []Token {
if width > step {
for i := 0; i < width-step+1; i++ {
gram := string(runes[i : i+step])
if _, ok := TT.Freq[gram]; ok {
if _, ok := trie.Freq[gram]; ok {
tokens = append(tokens, Token{gram, start + i, start + i + step})
}
}