Skip to content

Instantly share code, notes, and snippets.

@benman1
Last active March 27, 2020 14:46
Show Gist options
  • Save benman1/3d268be9fdfde0e20d2adb772df233d6 to your computer and use it in GitHub Desktop.
Save benman1/3d268be9fdfde0e20d2adb772df233d6 to your computer and use it in GitHub Desktop.
a simple example with wordnet
#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