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); }
void * ner_create_recognizer(const char * path) { NERWrapper * wrapper = new NERWrapper(); if (!wrapper->load(path)) { return 0; } return reinterpret_cast<void *>(wrapper); }
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); }