Esempio n. 1
0
// SetSentence2 is a method to set sentence
// This method does not take the ownership of the object
func (l *Lattice) SetSentence2(sentence string, length uint64) {
	i := C.CString(sentence)
	l.memorize.Cache("SetSentence2", i)
	//defer C.free(unsafe.Pointer(i))
	C.mecab_lattice_set_sentence2(l.toMecabLatticeT(), i, (C.size_t)(length))

}
Esempio n. 2
0
func (l Lattice) SetSentence(s string) {
	length := C.size_t(len(s))
	if s == "" {
		s = "dummy"
	}
	input := *(**C.char)(unsafe.Pointer(&s))
	C.mecab_lattice_add_request_type(l.lattice, 64) // MECAB_ALLOCATE_SENTENCE = 64
	C.mecab_lattice_set_sentence2(l.lattice, input, length)
}