summaryrefslogtreecommitdiffstats
path: root/input-methods/sulekha/src/suggestions.c~
diff options
context:
space:
mode:
authorSanthosh Thottingal <santhosh00@gmail.com>2007-10-27 15:36:57 -0400
committerSanthosh Thottingal <santhosh00@gmail.com>2007-10-27 15:36:57 -0400
commit49580bf92860d0e2df036cf2e294f6b26528a5d2 (patch)
tree3707190eb3779de32081d939f03e2dd3efe713af /input-methods/sulekha/src/suggestions.c~
parent40cdac44fe89856c3f068ddd9dd911d88da97eb4 (diff)
downloadRachana.git-49580bf92860d0e2df036cf2e294f6b26528a5d2.tar.gz
Rachana.git-49580bf92860d0e2df036cf2e294f6b26528a5d2.tar.xz
Rachana.git-49580bf92860d0e2df036cf2e294f6b26528a5d2.zip
Rearranged the code , config , make files preapred, addon to gtktextview added
transliteration completed. TODO: GUI coding and integration
Diffstat (limited to 'input-methods/sulekha/src/suggestions.c~')
-rw-r--r--input-methods/sulekha/src/suggestions.c~71
1 files changed, 71 insertions, 0 deletions
diff --git a/input-methods/sulekha/src/suggestions.c~ b/input-methods/sulekha/src/suggestions.c~
new file mode 100644
index 0000000..d037d21
--- /dev/null
+++ b/input-methods/sulekha/src/suggestions.c~
@@ -0,0 +1,71 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "aspell.h"
+AspellConfig *spell_config = NULL;
+AspellSpeller *spell_checker = 0;
+/*int
+main(int argc, const char *argv[])*/
+int
+check_word (char *lang, char *word)
+{
+ int correct = 0;
+
+ int word_length = 0;
+
+ if (lang == NULL)
+ {
+ lang = "ml";
+ }
+
+ word_length = strlen (word);
+ spell_config = new_aspell_config ();
+ aspell_config_replace (spell_config, "lang", lang);
+ aspell_config_replace (spell_config, "encoding", "utf-8");
+ AspellCanHaveError *possible_err = new_aspell_speller (spell_config);
+
+ if (aspell_error_number (possible_err) != 0)
+ puts (aspell_error_message (possible_err));
+ else
+ spell_checker = to_aspell_speller (possible_err);
+ correct = aspell_speller_check (spell_checker, word, word_length);
+
+ if (correct == 0)
+ {
+ printf ("word \"%s\" is wrong.\n", word);
+
+ }
+ else
+ {
+ printf ("word \"%s\" is correct.\n", word);
+ exit (0);
+ }
+
+
+ return correct;
+}
+
+void
+get_suggestion_list (char *word)
+{
+
+ const char *sugg_word;
+ int suggestion_count = 0;
+ int word_length = 0;
+ AspellWordList *suggestions = NULL;
+ suggestions = aspell_speller_suggest (spell_checker, word, word_length);
+ AspellStringEnumeration *aspell_elements =
+ aspell_word_list_elements (suggestions);
+
+ while ((sugg_word =
+ aspell_string_enumeration_next (aspell_elements)) != NULL)
+ {
+ printf ("%d. %s\n", ++suggestion_count, sugg_word);
+ }
+ delete_aspell_string_enumeration (aspell_elements);
+
+
+
+
+}