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

优化 jieba

This commit is contained in:
源文雨
2022-11-30 16:00:56 +08:00
parent 4d76899e79
commit 6982ead703
8 changed files with 114 additions and 109 deletions

View File

@@ -53,17 +53,17 @@ type TagExtracter struct {
}
// LoadDictionary reads the given filename and create a new dictionary.
func (t *TagExtracter) LoadDictionary(file fs.File) error {
func (t *TagExtracter) LoadDictionary(file fs.File) (err error) {
t.stopWord = NewStopWord()
t.seg = new(jieba.Segmenter)
return t.seg.LoadDictionary(file)
t.seg, err = jieba.LoadDictionary(file)
return
}
// LoadDictionaryAt reads the given filename and create a new dictionary.
func (t *TagExtracter) LoadDictionaryAt(fileName string) error {
func (t *TagExtracter) LoadDictionaryAt(file string) (err error) {
t.stopWord = NewStopWord()
t.seg = new(jieba.Segmenter)
return t.seg.LoadDictionaryAt(fileName)
t.seg, err = jieba.LoadDictionaryAt(file)
return
}
// LoadIdf reads the given file and create a new Idf dictionary.