示例#1
0
文件: stem.go 项目: goodsign/snowball
// Close frees native C resources
func (ws *WordStemmer) Close() error {
	ws.mutex.Lock()
	defer ws.mutex.Unlock()

	if nil != ws.stemmer {
		C.sb_stemmer_delete(ws.stemmer)
		ws.stemmer = nil
		return nil
	}

	return fmt.Errorf("Cannot close: stemmer is not valid.")
}
示例#2
0
// internal method for GCing the C allocated stemmer
func (s Stemmer) Close() {
	C.sb_stemmer_delete(s.stemmer)
}
示例#3
0
// free C resources
func free(stmr *Stemmer) {
	if stmr.stmr != nil {
		C.sb_stemmer_delete(stmr.stmr)
		stmr.stmr = nil
	}
}