Created
July 30, 2013 12:58
-
-
Save akhenakh/6112663 to your computer and use it in GitHub Desktop.
test libstemmer on Mac using macports: clang -I/opt/local/include -L/opt/local/lib -lstemmer test.c -o test
on Linux gcc -o test test.c -lstemmer (apt-get install libstemmer-dev See associated code in Golang http://play.golang.org/p/1QnkCZtuYr
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 <stdlib.h> | |
#include <stdio.h> | |
#include <libstemmer.h> | |
int main () { | |
struct sb_stemmer* sb; | |
sb_symbol* res; | |
int size; | |
sb = sb_stemmer_new("english", "UTF_8"); | |
if (sb == NULL) { | |
printf("init error\n"); | |
exit(1); | |
} | |
const sb_symbol * stemmed = sb_stemmer_stem(sb, "eating", 6); | |
if (stemmed == NULL) | |
{ | |
printf("Out of memory\n"); | |
exit(1); | |
} | |
size = sb_stemmer_length(sb); | |
if (size > 0) { | |
printf("%s\n", stemmed); | |
} else { | |
printf("no stem\n"); | |
} | |
sb_stemmer_delete(sb); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment