示例#1
0
文件: web.go 项目: bcampbell/bleve
func TokenizerConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.Tokenizer, error) {
	remainingTokenizer, err := cache.TokenizerNamed(unicode.Name)
	if err != nil {
		return nil, err
	}
	return exception.NewExceptionsTokenizer(exceptionsRegexp, remainingTokenizer), nil
}
示例#2
0
文件: dump.go 项目: pmezard/apec
func analyzeFn(cfg *Config) error {
	reExc, err := regexp.Compile(`(?i)c\+\+`)
	if err != nil {
		return err
	}
	uni := unicode.NewUnicodeTokenizer()
	tokenizer := exception.NewExceptionsTokenizer(reExc, uni)
	tokens := tokenizer.Tokenize([]byte(*analyzeArg))
	for _, t := range tokens {
		fmt.Println(t)
	}
	return nil
}