2011年8月21日星期日

Summary of What I have done in GSoc2011


Summary of What I have done in GSoc2011. 1
1 Hyphenation module in Enchant 3
1.1 Add hyphenation function in Enchant 3
1.2 Add five backends to support hyphenation. 3
1.3 ISpell 5
1.4 MySpell 5
1.5 zemberek. 6
1.6 voikko. 7
1.7 Deploy of enchant in Abiword. 7
1.8 Test in Linux. 8
2 Call the Hyphenation function in Abiword. 8
3 Simple Implementation of Chinese Spell-Check in Enchant. 10
4 Code Re-factor and debug. 10
5. User interface to manage hyphenation. 10
6. How to Support more languages. 11
6.1 How to support more languages in ISpell 12
6.2 How to support more languages in mySepll 13
7. How to extend the enchant function. 13


Until now, my works in GSoc2011 including four parts as following:
1.Hyphenation module in Enchant
Ø  Read and get totally understand the source code of Enchant
Ø  Reuse the abstract layer of Enchant and add Hyphenation function in Enchant, so that we can add more language easily
Ø  Deal with more languages
Ø  Add five backend implementation, including ispell, myspell, zemberek, voikko, uspell
Ø  Deal with the spelling-checking module

2.Call the Hyphenation function in Abiword.
Ø  Find split info using enchant_dict_hyphenate
Ø  Split Text_Run to split word pass the line width and keep their format
Ø  Deal with user's operation(select, delete, cut, paste)
Ø  User can select weather to enable the hyphenation function

3. Simple Implementation of Chinese Spell-Checking in Enchant
Ø  Add a simple spell-check framework for Chinese in Enchant
Ø  Add library to support
Ø  Some survey about Chinese Spell-checking

4. Code Re-factor and debug
Ø  Code Re-factor, include keep the code flexible
Ø  Debug coding problem

5. User interface to manage hyphenation
Ø  Windows, Linux, and Cocoa

6. How to Support more languages
Ø  How to support more languages in ISpell
Ø  How to support more languages in mySepll

7. How to extend the enchant function

2011年8月9日星期二

the works in Enchant

1 add hyphenation function in Enchant
what I have done:
Firstly, I add hyphenation module in Enchant:
================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;

2 add five backends to support hyphenation
  including ispell, myspell, zemberek, voikko, uspell

we all know that Enchant has eight types of backend to support multi-language.
USpell
HSpell
ASpell
MySpell....

but I found that in Abiword. we only use two backends:
libenchant_ispell.dll  libenchant_myspell.dll

another surprising thing is that in the dictionary\ispell I can only
find one dic: american.hash(En_US)
and the hunspell dic is empty~~


the changes:
1 deleted the unneed connection, such as HSpell
2 add hunspell(myspell) hyphenation code
3 implement hyphenation using hunspell
4 implement hyphenation using Zemberek

================1 deleted the unneed connection, such as HSpell===========
Hebrew dont need any hyphenation
Yiddish dont need any hyphenation

====================2  implement hyphenation using hunspell
added files:
hyphen/hnjalloc.h
hyphen/hnjalloc.c
hyphen/hyph_en_US.dic
hyphen/hyphen.c
hyphen/hyphen.gyp
hyphen/hyphen.h
hyphen/hyphen.patch
hyphen/hyphen.tex

need more tests

==================== 3 implement hyphenation using Zemberek
 just using dbus_g_proxy_call:

 char* Zemberek::hyphenate(const char* word)
{
       char* result;
       GError *Error = NULL;
       if (!dbus_g_proxy_call (proxy, "hecele", &Error,
               G_TYPE_STRING,word,G_TYPE_INVALID,
               G_TYPE_STRV, &result,G_TYPE_INVALID)) {
                       g_error_free (Error);
                       return NULL;
       }

       char*result=0;
       return result;
}


The attachment is the updated version today. Now we have four backends
of hyphenantion
1 hunspell: using seperated dic: such as hyph_en_us.dic.
  we can download dic from internet
2 libhyphenaiton: the dic is provided by author, sometimes limited
3 zemberek: for Turkis
4 Voikko: for Finnish


3 the depot of enchant
I just copy the bulid result of enchant:
enchant\bin\Debug\libenchant_myspell.dll ---->
abiword\msvc2008\Debug\lib\enchant\libenchant_myspell.dll
enchant\bin\Debug\libenchant_ispell.dll ---->
abiword\msvc2008\Debug\lib\enchant\libenchant_ispell.dll
enchant\bin\Debug\libenchant.dll ---->abiword\msvc2008\Debug\bin\ibenchant.dll

3 the implementation of the five backends
4 call hyphenation module of enchant to display the hyphenation-result
in abiword
5 after user's operation, refresh the hyphenation-result accordingly
  include user adding new word, delete word, copy word, cut word


6 test in Linux
todo:
1 Fully support hyphenation in Abiword
2 Support more language besides En_us
3 Some tests in Linux(Unix)


Still to improve:
1 code re-factor
2 deal with more language
3 include more user's operation(such as operate with picture may
influence the hyphenation result)

the summary about What I have done in GSoc2011

my works in GSoc2011 including two parts.
1 the hyphenation module in Enchant
 Key: to reuse the abstract layer of Enchant and add Hyphenation function
         we can add more language easy
         Deal with more languages





2  call in Abiword. including:
   split run
   find split info
   deal with user's operation

















2011年5月17日星期二

new version, but a lot of question~confusing

Hi, All.
I am working on GSoc Abiword this summer to implement the hyphenation support in Abiword. Before I implement the function, I find some code  in Abiword for spell-checking. so I follow the code to implement hyphenation function using enchant. And I have some questiones about enchant. thanks
I want to use enchant to implement hyphenation to keep the dictionary seperately.
 
the attachment1 is the main class diagram
the attachment2 is the code I implement the hyphenation follow spell-checking code
 
 
My question is:
1. Is there some funcition for hyphenation like enchant_dict_hyphenate in Enchant? 
2. how the enchant achieve the function? I can track in the code in enchant~
3. give some suggestion to me about my codes, thanks
 
 
 
Thanks very much~

2011年5月11日星期三

a smiple version.

a smiple version. 
You own the copyright for whatever work you do. All of your work must
be licensed under the GPL2 or later. Please add your name + email
address to the headers of each file that you touch.

2011年4月27日星期三

patch file_Implement progress bar in windows

The patch file I have modified in the following spaces, to keep same with the source code:
==================1 ap_usb_ProgressListener======
create a class to deal with ProgressListener(the same as the gtk code). seperate from the statusBarListener
class ap_usb_ProgressListener : public AP_StatusBarFieldListener
{
public:
.............
virtual void notify();   //deal with progressbar update
protected:
HWND m_ProgressWND;
};
==================2======
and in the notify function deal with the update:   and i find the place to add pulse process bar
void ap_usb_ProgressListener::notify()
{  
if(pProgress->isDefinate())
{
double fraction = pProgress->getFraction();
SendMessage(m_ProgressWND,PBM_SETPOS,fraction*100,0);
}
else
{   //here pulse process bar  <--------------pulse process bar
}
}
===========================3============
In this situation, I need to build the connection between ap_usb_ProgressListener and ProcessBar in the createWindow()    in this place, your code have one error(the elseif is in the wrong place)
else if(pf->getFillMethod() == PROGRESS_BAR)
{
pf->setListener((AP_StatusBarFieldListener *)(new ap_usb_ProgressListener(pf, m_hwndProgressBar)));
}
===========================4============
Remove unused function and variables