summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchenxiajian <chenxiajian1985@gmail.com>2011-07-08 09:27:17 +0000
committerchenxiajian <chenxiajian1985@gmail.com>2011-07-08 09:27:17 +0000
commitaaa3b9404cc65b8d73e2af8455b170c04a6b5348 (patch)
tree1914f50055eb385f35006c5a0f3ac753a634b00f
parentfbe15ffab2a7008d613317c4ec7f3b2362d2c39c (diff)
downloadenchant-aaa3b9404cc65b8d73e2af8455b170c04a6b5348.tar.gz
patch 0622
1 I think return char * is a better way. like Voikko: char * voikko_hyphenate_cstr(int handle, const char * word); char * voikko_hyphenate_ucs4(int handle, const wchar_t * word); 2 detailed implementation using voikko(need more tests) git-svn-id: svn+ssh://svn.abisource.com/svnroot/enchant/branches/gsoc2011hyphenation@29997 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6
-rw-r--r--src/enchant++.h28
-rw-r--r--src/enchant-provider.h7
-rw-r--r--src/enchant.c47
-rw-r--r--src/enchant.h9
-rw-r--r--src/hspell/hspell_provider.c25
-rw-r--r--src/ispell/ispell_checker.cpp33
-rw-r--r--src/ispell/ispell_checker.h5
-rw-r--r--src/uspell/uspell_provider.cpp27
-rw-r--r--src/voikko/voikko_provider.c15
-rw-r--r--src/zemberek/zemberek.h4
-rw-r--r--src/zemberek/zemberek_provider.cpp7
11 files changed, 203 insertions, 4 deletions
diff --git a/src/enchant++.h b/src/enchant++.h
index cce0e19..f4a43f0 100644
--- a/src/enchant++.h
+++ b/src/enchant++.h
@@ -112,6 +112,7 @@ namespace enchant
suggest (utf8word, result);
return result;
}
+<<<<<<< .mine
void hyphenate (const std::string & utf8word,
std::vector<std::string> & out_suggestions) {
@@ -137,6 +138,33 @@ namespace enchant
hyphenate (utf8word, result);
return result;
}
+=======
+
+ void hyphenate (const std::string & utf8word,
+ std::string & out_suggestions) {
+ //not implement yet chenxiajian
+ }
+
+ std::string hyphenate (const std::string & utf8word) {
+ std::string result;
+ hyphenate (utf8word, result);
+ return result;
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+>>>>>>> .theirs
void add (const std::string & utf8word) {
enchant_dict_add (m_dict, utf8word.c_str(),
diff --git a/src/enchant-provider.h b/src/enchant-provider.h
index 8b88176..fca76f6 100644
--- a/src/enchant-provider.h
+++ b/src/enchant-provider.h
@@ -102,10 +102,17 @@ struct str_enchant_dict
void (*add_to_exclude) (struct str_enchant_dict * me,
const char *const word, size_t len);
+<<<<<<< .mine
char **(*hyphenate) (struct str_enchant_dict * me,
const char *const word, size_t len,
size_t * out_n_suggs);
+=======
+
+ char *(*hyphenate) (struct str_enchant_dict * me,
+ const char *const word);
+
+>>>>>>> .theirs
void * _reserved[5];
};
diff --git a/src/enchant.c b/src/enchant.c
index b1852fe..962951b 100644
--- a/src/enchant.c
+++ b/src/enchant.c
@@ -1012,6 +1012,7 @@ enchant_dict_suggest (EnchantDict * dict, const char *const word,
return suggs;
}
+<<<<<<< .mine
ENCHANT_MODULE_EXPORT (char **)
enchant_dict_hyphenate (EnchantDict * dict, const char *const word,
@@ -1056,6 +1057,52 @@ enchant_dict_hyphenate (EnchantDict * dict, const char *const word,
return suggs;
}
+=======
+
+ENCHANT_MODULE_EXPORT (char *)
+enchant_dict_hyphenate (EnchantDict * dict, const char *const word)
+{
+ EnchantSession * session;
+ size_t n_suggs = 0, n_dict_suggs = 0, n_pwl_suggs = 0, n_suggsT = 0;
+ char **suggs, **dict_suggs = NULL, **pwl_suggs = NULL, **suggsT;
+
+
+ char*result=0;
+
+ g_return_val_if_fail (dict, NULL);
+ g_return_val_if_fail (word, NULL);
+
+
+ session = ((EnchantDictPrivateData*)dict->enchant_private_data)->session;
+ enchant_session_clear_error (session);
+ /* Check for suggestions from provider dictionary */
+ if (dict->hyphenate)
+ {
+ dict_suggs = (*dict->hyphenate) (dict, word);
+
+ }
+
+
+ return result;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+>>>>>>> .theirs
/**
* enchant_dict_add
* @dict: A non-null #EnchantDict
diff --git a/src/enchant.h b/src/enchant.h
index b9af271..3ff6d10 100644
--- a/src/enchant.h
+++ b/src/enchant.h
@@ -112,12 +112,21 @@ ENCHANT_MODULE_EXPORT (int)
ENCHANT_MODULE_EXPORT (char **)
enchant_dict_suggest (EnchantDict * dict, const char *const word,
ssize_t len, size_t * out_n_suggs);
+<<<<<<< .mine
ENCHANT_MODULE_EXPORT (char **)
enchant_dict_hyphenate (EnchantDict * dict, const char *const word,
ssize_t len, size_t * out_n_suggs);
+=======
+
+ENCHANT_MODULE_EXPORT (char *)
+enchant_dict_hyphenate (EnchantDict * dict, const char *const word);
+
+
+
+>>>>>>> .theirs
ENCHANT_MODULE_EXPORT (void)
enchant_dict_add (EnchantDict * dict, const char *const word,
ssize_t len);
diff --git a/src/hspell/hspell_provider.c b/src/hspell/hspell_provider.c
index 8357510..4e10f2b 100644
--- a/src/hspell/hspell_provider.c
+++ b/src/hspell/hspell_provider.c
@@ -181,6 +181,7 @@ hspell_dict_suggest (EnchantDict * me, const char *const word,
return sugg_arr;
}
+<<<<<<< .mine
static char **
hspell_dict_hyphenate (EnchantDict * me, const char *const word,
size_t len, size_t * out_n_suggs)
@@ -203,6 +204,30 @@ hspell_dict_hyphenate (EnchantDict * me, const char *const word,
return sugg_arr;
}
+=======
+static char *
+hspell_dict_hyphenate (EnchantDict * me, const char *const word)
+{
+
+ int res;
+ gsize length;
+ char *iso_word;
+ char **sugg_arr = NULL;
+ struct corlist cl;
+ struct dict_radix *hspell_dict;
+
+ hspell_dict = (struct dict_radix *)me->user_data;
+///not implement yet! chenxiajian///
+
+
+ /* free the word */
+ g_free (iso_word);
+
+ char*result=0;
+ return result;
+}
+
+>>>>>>> .theirs
static EnchantDict *
hspell_provider_request_dict (EnchantProvider * me, const char *const tag)
{
diff --git a/src/ispell/ispell_checker.cpp b/src/ispell/ispell_checker.cpp
index de8f82a..2d4a6b3 100644
--- a/src/ispell/ispell_checker.cpp
+++ b/src/ispell/ispell_checker.cpp
@@ -272,6 +272,7 @@ ISpellChecker::suggestWord(const char * const utf8Word, size_t length,
return sugg_arr;
}
+<<<<<<< .mine
char **
ISpellChecker::hyphenate(const char * const utf8Word, size_t length,
@@ -288,6 +289,24 @@ ISpellChecker::hyphenate(const char * const utf8Word, size_t length,
return sugg_arr;
}
+=======
+
+char *
+ISpellChecker::hyphenate(const char * const utf8Word)
+{
+ ichar_t iWord[INPUTWORDLEN + MAXAFFIXLEN];
+ char word8[INPUTWORDLEN + MAXAFFIXLEN];
+ int c;
+
+ char **sugg_arr = NULL;
+ ///not implement yet! chenxiajian///
+
+ char*result=0;
+ return result;
+}
+
+
+>>>>>>> .theirs
static GSList *
ispell_checker_get_dictionary_dirs (EnchantBroker * broker)
{
@@ -545,6 +564,7 @@ ispell_dict_suggest (EnchantDict * me, const char *const word,
return checker->suggestWord (word, len, out_n_suggs);
}
+<<<<<<< .mine
static char **
ispell_dict_hyphenate (EnchantDict * me, const char *const word,
size_t len, size_t * out_n_suggs)
@@ -556,6 +576,19 @@ ispell_dict_hyphenate (EnchantDict * me, const char *const word,
}
+=======
+static char *
+ispell_dict_hyphenate (EnchantDict * me, const char *const word)
+{
+ ISpellChecker * checker;
+
+ checker = (ISpellChecker *) me->user_data;
+ return checker->hyphenate (word);
+}
+
+
+
+>>>>>>> .theirs
static int
ispell_dict_check (EnchantDict * me, const char *const word, size_t len)
{
diff --git a/src/ispell/ispell_checker.h b/src/ispell/ispell_checker.h
index 674fc36..361baa0 100644
--- a/src/ispell/ispell_checker.h
+++ b/src/ispell/ispell_checker.h
@@ -14,8 +14,13 @@ public:
bool checkWord(const char * const word, size_t len);
char ** suggestWord(const char * const word, size_t len, size_t * out_n_suggs);
+<<<<<<< .mine
char ** hyphenate(const char * const word, size_t len, size_t * out_n_suggs);
+=======
+ char * hyphenate(const char * const word);
+
+>>>>>>> .theirs
bool requestDictionary (const char * szLang);
private:
diff --git a/src/uspell/uspell_provider.cpp b/src/uspell/uspell_provider.cpp
index 2301e15..0a54819 100644
--- a/src/uspell/uspell_provider.cpp
+++ b/src/uspell/uspell_provider.cpp
@@ -212,6 +212,7 @@ uspell_dict_suggest (EnchantDict * me, const char *const word,
return sugg_arr;
} // uspell_dict_suggest
+<<<<<<< .mine
static char **
uspell_dict_hyphenate (EnchantDict * me, const char *const word,
size_t len, size_t * out_n_suggs)
@@ -236,6 +237,32 @@ uspell_dict_hyphenate (EnchantDict * me, const char *const word,
}
+=======
+static char *
+uspell_dict_hyphenate (EnchantDict * me, const char *const word)
+{
+ uSpell *manager;
+ utf8_t myWord[MAXCHARS];
+
+ char **sugg_arr = NULL;
+ const utf8_t *sugg;
+ wide_t buf[MAXCHARS];
+ int length;
+ unsigned int i;
+ utf8_t **list;
+
+ if (len >= MAXCHARS) // no suggestions; the word is outlandish
+ return NULL;
+
+ ///not implement yet! chenxiajian///
+
+ free(list);
+ char*result=0;
+ return result;
+}
+
+
+>>>>>>> .theirs
static void
uspell_dict_add_to_session (EnchantDict * me, const char *const word,
size_t len)
diff --git a/src/voikko/voikko_provider.c b/src/voikko/voikko_provider.c
index 44f1e59..48b916b 100644
--- a/src/voikko/voikko_provider.c
+++ b/src/voikko/voikko_provider.c
@@ -78,6 +78,7 @@ voikko_dict_suggest (EnchantDict * me, const char *const word,
return sugg_arr;
}
+<<<<<<< .mine
static char **
voikko_dict_hyphenate (EnchantDict * me, const char *const word,
size_t len, size_t * out_n_suggs)
@@ -88,6 +89,20 @@ voikko_dict_hyphenate (EnchantDict * me, const char *const word,
return sugg_arr;
}
+
+=======
+static char *
+voikko_dict_hyphenate (EnchantDict * me, const char *const word)
+{
+ char*result=0;
+ int voikko_handle;
+ voikko_handle = (long) me->user_data;
+
+ result=voikko_hyphenate_cstr(voikko_handle,word);
+ return result;
+}
+
+>>>>>>> .theirs
static EnchantDict *
voikko_provider_request_dict (EnchantProvider * me, const char *const tag)
{
diff --git a/src/zemberek/zemberek.h b/src/zemberek/zemberek.h
index 1b9ad9f..f8a968e 100644
--- a/src/zemberek/zemberek.h
+++ b/src/zemberek/zemberek.h
@@ -41,7 +41,11 @@ public:
int checkWord(const char* word) const;
char** suggestWord(const char* word, size_t *out_n_suggs);
+<<<<<<< .mine
char** hyphenate(const char* word, size_t *out_n_suggs);
+=======
+ char* hyphenate(const char* word);
+>>>>>>> .theirs
private:
DBusGConnection *connection;
diff --git a/src/zemberek/zemberek_provider.cpp b/src/zemberek/zemberek_provider.cpp
index a8cd4ae..7ae925a 100644
--- a/src/zemberek/zemberek_provider.cpp
+++ b/src/zemberek/zemberek_provider.cpp
@@ -59,13 +59,12 @@ zemberek_dict_suggest (EnchantDict * me, const char *const word,
return checker->suggestWord (word, out_n_suggs);
}
-static char**
-zemberek_dict_hyphenate (EnchantDict * me, const char *const word,
- size_t len, size_t * out_n_suggs)
+static char*
+zemberek_dict_hyphenate (EnchantDict * me, const char *const word)
{
Zemberek *checker;
checker = (Zemberek *) me->user_data;
- return checker->hyphenate (word, out_n_suggs);
+ return checker->hyphenate (word);
}