Re: patch: enchant_dict_hyphenation_chenxiajian

From: Kathiravelu Pradeeban <kk.pradeeban_at_gmail.com>
Date: Tue Jun 21 2011 - 05:35:59 CEST

Great. I am having a look. We have planned to discuss further on the
progress and the patch, the coming weekend.

Regards,
Pradeeban.

2011/6/20 chenxiajian1985 <chenxiajian1985@gmail.com>:
> Hi
>
> the attachment is the patch file that I implemented the hyphenation using enchant. but the concreate backend implementation is doing now, we can have more discussion about it. Thanks
>
> ================about the code===========
> I think we can combine the hyphenation with spell-checking together. so that we can make the code more flexsible.
> In my opinion, we can make code like this:
> EnchantDict* enchant_broker_request_dict (EnchantBroker* broker, const char *const lang); //same as spell-checking
> char *enchant_dict_hyphenate(EnchantDict *dict, const char *const word,size_t len);
>
> ===================== 1
> In order to achieve this, we need to add hyphenation function in EnchantDict. something like:
> char **(*hyphenate) (struct str_enchant_dict * me,
> const char *const word, size_t len,
> size_t * out_n_suggs);
>
> ======================== 2
> and the function is implement by the backend.
> static char **
> ispell_dict_hyphenate (EnchantDict * me, const char *const word,
> size_t len, size_t * out_n_suggs)
> {
> ISpellChecker * checker;
>
> checker = (ISpellChecker *) me->user_data;
> return checker->hyphenate (word, len, out_n_suggs);
> }
> ====================3
> finally, we set the connetion
>
> dict->hyphenate = ispell_dict_hyphenate;
> dict->suggest = hspell_dict_hyphenate;
> dict->suggest = zemberek_dict_hyphenate;
>
>
> some good idea?
>
>
> chen xiajian
>
>
>
> 发件人: Urmas
> 发送时间: 2011-06-14 22:02:23
> 收件人: abiword-dev
> 抄送:
> 主题: Re: chenxiajian_enchant_dict_hyphenationSuggest ?
>
> From: "chenxiajian1985" <chenxiajian1985@gmail.com>
> Subject: chenxiajian_enchant_dict_hyphenationSuggest ?
>> I try to implement hyphenation using enchant. so I add one method in enchant.
>> ENCHANT_MODULE_EXPORT (char **)
>> enchant_dict_hyphenationSuggest (EnchantDict * dict, const char *const word,
>> ssize_t len, size_t * out_n_suggs);
>>
> No, you'll need a separate object for doing hyphenation, something like:
> EnchantHyph* enchant_broker_request_hyph(EnchantBroker*, const char *const lang);
> to create an provider-dependant hyphenation object, and
> char *enchant_hyph_hyphenate(EnchantHyph *hyphenator, const char *const word);
> which would call a virtual method of "hyphenator" to obtain results;
>>
>> 2. what is the best way to encode hyphenation results from enchant
>> now I used (char **) to save the hyphenation results:
>> such as : the word "hyphenation" can be save as:
>> "hy-phen-ation" "hyphen-ation"....
> That's looks like terribly inefficient way, better just to return a string with embedded meta-characters (like '~' or control ones) in most desired and less desired breakpoints.
>

-- 
Kathiravelu Pradeeban.
Software Engineer.
WSO2 Inc.
Blog: [Llovizna] http://kkpradeeban.blogspot.com/
Received on Tue Jun 21 05:36:31 2011

This archive was generated by hypermail 2.1.8 : Tue Jun 21 2011 - 05:36:32 CEST