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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user