mirror of
https://github.com/fumiama/jieba.git
synced 2026-06-05 00:32:51 +08:00
added a new interface for caching
This commit is contained in:
6
jieba.go
6
jieba.go
@@ -9,6 +9,8 @@ import (
|
||||
"sort"
|
||||
)
|
||||
|
||||
const cacheNameFormat = "jieba.%x.cache"
|
||||
|
||||
var (
|
||||
// Word/Tag Map load from user dictionary
|
||||
UserWordTagTab = make(map[string]string)
|
||||
@@ -57,6 +59,10 @@ func (j *Jieba) AddEntry(entry *Entry) {
|
||||
j.Add(entry.Word, entry.Freq)
|
||||
}
|
||||
|
||||
func (j *Jieba) CacheNameFormat() string {
|
||||
return cacheNameFormat
|
||||
}
|
||||
|
||||
func (j *Jieba) Add(word string, freq float64) {
|
||||
j.Freq[word] = freq
|
||||
j.Total += freq
|
||||
|
||||
Reference in New Issue
Block a user