1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-06-30 00:50:30 +08:00

fixed the bug from issue #132 from original jieba issue track

- issue details from https://github.com/fxsjy/jieba/issues/132
 - updated tests
 - also some code refactors
This commit is contained in:
Wang Bin
2014-08-08 17:59:49 +08:00
parent 08cb04815c
commit 3d685f1980
7 changed files with 107 additions and 19 deletions

View File

@@ -12,8 +12,7 @@ import (
)
var (
WordTagTab = make(map[string]string)
isUserDictLoaded = false
WordTagTab = make(map[string]string)
)
type WordTag struct {
@@ -282,11 +281,9 @@ func cut(sentence string, HMM bool) []WordTag {
}
func Cut(sentence string, HMM bool) []WordTag {
if !isUserDictLoaded {
for key, value := range jiebago.UserWordTagTab {
WordTagTab[key] = value
}
isUserDictLoaded = true
for key := range jiebago.UserWordTagTab {
WordTagTab[key] = jiebago.UserWordTagTab[key]
delete(jiebago.UserWordTagTab, key)
}
return cut(sentence, HMM)
}