Ejemplo n.º 1
0
void * segmentor_create_segmentor(const char * path, const char * lexicon_file) {
  SegmentorWrapper * wrapper = new SegmentorWrapper();

  if (!wrapper->load_baseline(path, lexicon_file)) {
    delete wrapper;
    return 0;
  }

  return reinterpret_cast<void *>(wrapper);
}
Ejemplo n.º 2
0
void * segmentor_create_customized_segmentor(const char * baseline_model_path,
                                  const char * model_path,
                                  const char * lexicon_path) {
  SegmentorWrapper * wrapper = new SegmentorWrapper();

  if (!wrapper->load_baseline(baseline_model_path)) {
    delete wrapper;
    return 0;
  }

  if (!wrapper->load_customized(model_path, lexicon_path)) {
    delete wrapper;
    return 0;
  }

  return reinterpret_cast<void *>(wrapper);
}