1 Star 0 Fork 0

join90 / gojieba

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
config.go 947 Bytes
一键复制 编辑 原始数据 按行查看 历史
Yanyi Wu 提交于 2016-09-07 00:37 . fix issue 8
package gojieba
import (
"path"
"runtime"
)
var (
DICT_DIR string
DICT_PATH string
HMM_PATH string
USER_DICT_PATH string
IDF_PATH string
STOP_WORDS_PATH string
)
func init() {
DICT_DIR = path.Join(path.Dir(getCurrentFilePath()), "dict")
DICT_PATH = path.Join(DICT_DIR, "jieba.dict.utf8")
HMM_PATH = path.Join(DICT_DIR, "hmm_model.utf8")
USER_DICT_PATH = path.Join(DICT_DIR, "user.dict.utf8")
IDF_PATH = path.Join(DICT_DIR, "idf.utf8")
STOP_WORDS_PATH = path.Join(DICT_DIR, "stop_words.utf8")
}
const TOTAL_DICT_PATH_NUMBER = 5
func getDictPaths(args ...string) [TOTAL_DICT_PATH_NUMBER]string {
dicts := [TOTAL_DICT_PATH_NUMBER]string{
DICT_PATH,
HMM_PATH,
USER_DICT_PATH,
IDF_PATH,
STOP_WORDS_PATH,
}
for i := 0; i < len(args) && i < len(dicts); i++ {
dicts[i] = args[i]
}
return dicts
}
func getCurrentFilePath() string {
_, filePath, _, _ := runtime.Caller(1)
return filePath
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zxcvzxcv/gojieba.git
git@gitee.com:zxcvzxcv/gojieba.git
zxcvzxcv
gojieba
gojieba
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891