Ejemplo n.º 1
0
func (t *TokenizeMecab) Tokenize(input string) *TokenizeMecabIter {
	p := C.CString(input)
	defer C.free(unsafe.Pointer(p))

	node := C.mecab_sparse_tonode(t.mecab, p)
	return &TokenizeMecabIter{node, node.next}
}
Ejemplo n.º 2
0
// SparseTonode is a method to parse given sentence and return Node object.
// You should not delete the returned node object. The returned buffer is overwritten when parse method is called again. You can traverse all nodes via Node::next member. This method is NOT thread safe.
func (t *Tagger) SparseTonode(str string) (*Node, error) {
	s := C.CString(str)
	t.memorize.Cache("SparseTonode", s)
	// defer C.free(unsafe.Pointer(s))
	return newNode(C.mecab_sparse_tonode(t.toMecabT(), s))
}