Example #1
0
// Create creates a Tagger object
// It is the caller's responsiblity to delete the tagger when it is done with it.
func Create(filename string) (*Tagger, error) {
	var rep *C.kytea_t
	name := C.CString(filename)
	defer C.free(unsafe.Pointer(name))
	rep = C.kytea_create()
	if rep == nil {
		return nil, errors.New("Cannot create a KyTea object")
	}
	if ret := C.kytea_read_model(rep, name); ret < 0 {
		return nil, errors.New("Cannot read the model")
	}

	config := C.kytea_get_config(rep)
	if config == nil {
		return nil, errors.New("Cannot get a KyTea config object")
	}
	return &Tagger{rep: rep, config: config}, nil
}
Example #2
0
func (k KyTea) Config() Config {
	return Config{
		config: C.kytea_get_config(k.kytea),
	}
}