Last active
March 27, 2020 14:46
-
-
Save benman1/3d268be9fdfde0e20d2adb772df233d6 to your computer and use it in GitHub Desktop.
a simple example with wordnet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <wn.h> | |
#include <stdlib.h> | |
#include <iostream> | |
// g++ wordnet_example.cpp /usr/lib/libwordnet.a -o wordnet_example | |
int main(int argc, char **argv) { | |
if (wninit()) { | |
printf("Fatal! Could not open the WordNet corpus!\n"); | |
exit(-1); | |
} | |
morphinit(); | |
std::string str = "hello"; | |
char* c_str = (char*)str.c_str(); | |
char* lemma = morphword(c_str, 1); | |
if(lemma == NULL) | |
lemma = c_str; | |
std::cout << lemma << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment