func (s *Stemmer) Process(input tokenizer.TokenChan) tokenizer.TokenChan { return filter.StartFilter(input, func(token *tokenizer.Token, output tokenizer.TokenChan) { str := token.Backing() cs := C.CString(str) defer C.free(unsafe.Pointer(cs)) end := C.stem(s.cstemmer, cs, C.int(len(str)-1)) + 1 output <- tokenizer.NewToken(str[0:end]) }) }
func (ps *PorterStemmer) Stem(s string) string { cs := C.CString(s) defer C.free(unsafe.Pointer(cs)) end := C.stem(ps.cstemmer, cs, C.int(len(s)-1)) + 1 return s[0:end] }