Пример #1
0
int ner_recognize(void * ner,
        const std::vector<std::string> & words,
        const std::vector<std::string> & postags,
        std::vector<std::string> & tags) {
    NERWrapper * wrapper = 0;
    wrapper = reinterpret_cast<NERWrapper *>(ner);
    return wrapper->recognize(words, postags, tags);
}
Пример #2
0
void * ner_create_recognizer(const char * path) {
    NERWrapper * wrapper = new NERWrapper();

    if (!wrapper->load(path)) {
        return 0;
    }

    return reinterpret_cast<void *>(wrapper);
}
Пример #3
0
int ner_recognize(void * ner,
    const std::vector<std::string> & words,
    const std::vector<std::string> & postags,
    std::vector<std::string> & tags) {

  if (words.size() != postags.size()) {
    return 0;
  }

  for (int i = 0; i < words.size(); ++ i) {
    if (words[i].empty() || postags.empty()) {
      return 0;
    }
  }

  NERWrapper * wrapper = 0;
  wrapper = reinterpret_cast<NERWrapper *>(ner);
  return wrapper->recognize(words, postags, tags);
}