Last active
December 27, 2015 01:59
-
-
Save agasiev/7248800 to your computer and use it in GitHub Desktop.
Hunspell spelling test.
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 <hunspell/hunspell.h> | |
int main() { | |
Hunhandle *spellObj = Hunspell_create("/home/artem/rude/ru_RU.aff", "/home/artem/rude/ru_RU.dic"); | |
char str[60]; | |
scanf("%s", str); | |
int result = Hunspell_spell(spellObj, str); | |
if(result == 0) { | |
printf("Spelling error!\n"); | |
char **s = NULL; | |
int r = Hunspell_suggest(spellObj, &s, str); | |
printf("r = %d\n", r); | |
for (int i = 0; i < r; i++) { | |
printf("%d) %s\n", i+1, s[i]); | |
} | |
Hunspell_free_list(spellObj, &s, r); | |
} | |
else { | |
printf("Correct Spelling!"); | |
int r = Hunspell_stem(spellObj, &s, str); | |
printf("Correct Spelling!\n"); | |
printf("Stems = %d\n", r); | |
for (int i = 0; i < r; i++) { | |
printf("%d - %d) %s\n", c, i+1, s[i]); | |
} | |
Hunspell_free_list(spellObj, &s, r); | |
} | |
Hunspell_destroy(spellObj); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment