int postagger_postag(void * postagger, const std::vector<std::string> & words, std::vector<std::string> & tags) { // std::cout << "input str = " << str << std::endl; PostaggerWrapper * wrapper = 0; wrapper = reinterpret_cast<PostaggerWrapper *>(postagger); return wrapper->postag(words, tags); }
void * postagger_create_postagger(const char * path, const char * lexicon_file) { PostaggerWrapper * wrapper = new PostaggerWrapper(); if (!wrapper->load(path, lexicon_file)) { return 0; } return reinterpret_cast<void *>(wrapper); }
int postagger_postag(void * postagger, const std::vector<std::string> & words, std::vector<std::string> & tags) { if (0 == words.size()) { return 0; } for (int i = 0; i < words.size(); ++ i) { if (words[i].empty()) { return 0; } } PostaggerWrapper * wrapper = 0; wrapper = reinterpret_cast<PostaggerWrapper *>(postagger); return wrapper->postag(words, tags); }