func init() { keyString = getMapKeys() reg = regexp.MustCompile("([" + keyString + "])") //初始化时将gojieba实例化到内存 jieba = gojieba.NewJieba() //初始化多音字到内存 initPhrases() }
func NewJiebaTokenizer(dictpath, hmmpath, userdictpath, idf, stop_words string) *JiebaTokenizer { x := gojieba.NewJieba(dictpath, hmmpath, userdictpath, idf, stop_words) return &JiebaTokenizer{x} }