Beispiel #1
0
// 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.")
}
Beispiel #2
0
// internal method for GCing the C allocated stemmer
func (s Stemmer) Close() {
	C.sb_stemmer_delete(s.stemmer)
}
Beispiel #3
0
// free C resources
func free(stmr *Stemmer) {
	if stmr.stmr != nil {
		C.sb_stemmer_delete(stmr.stmr)
		stmr.stmr = nil
	}
}