代码拉取完成,页面将自动刷新
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
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。