Sunday, February 22, 2009

Spell checking and Hypenation- the .NET way of Hunspell

On our homepage i use a .NET based CMS which is able to hyphenate the text with soft hyphens (SHY). I've used a large dictionary for this, but i want to improve this a little. If you google spell checking and hyphenation you fill find sooner or later Hunspell. Hunspell is the spell checker used in OpenOffice and Mozilla Firefox 3 & Thunderbird.Unfortunally this is C and C++ code and not .NET. So i looked at the library and see it is only x86 and ugly to marshall. The simple PInvoke way was obstructed.

I decided to use managed C++ to port this code to .NET and implement a proxy patetrn to use the original code wih only little modifications. I've hosted this project on Sourceforge and gave it the name NHunspell for .NET Hunspell. This is the project URL:
http://nhunspell.sourceforge.net

Hunspell is tri licenced under GPL/LGPL/MPL, and NHunspell follows this. If you nedd a spell checker for the :NET plattform you can give it a try.

11 comments:

Paul said...

Hi, You beat me to releasing this. I was using hunspell in netspell 3.0 that I've been working on. We could share code base if you want?

~ Paul

Thomas Maierhofer - MSE-iT said...

Do you port hunspell or do you use the original c++ code? I try to use the unmodified original code because i can follow Lazlos development faster. The disadvantage is that the assembly has native c++ code inside and needs the unmanaged permission. But this is no problem for me and the most desktop/server apps.

Paul said...

I did it very similar to you. I created a mixed c++ clr project. I had the same thought about using mixed c++ clr as you. Another disadvantage is you can't ILMerge it.

One thing I noticed is you might consider using the marshal_context for string marshaling.

~ Paul

Orion said...

Hi i used ur Nhunspell with openoffice dictionary and it works perfect. Except the Add(word) method. This method does nothing. I think it is supossed to add a word to dictionary, but the file is not modified at all. MAybe AddWithAffix works, but i dont know how to generate afix (i dont know what affix is at all). Cause i cannot add user words to dictionary, i can not use it :o(

Thomas Maierhofer said...

The Add(word) function adds a word into the loaded dictionary. The original dictionary file is not modified. This can be used to add words from a user dictionary. But it most be done every time you load a dictionary and use it later.

Best regards

Thomas

Orion said...

Ah ok, thats fine for me everytime i need add the custom word list to dicionary. gj.

buzzingstreet said...

Dear Visitor,
Thanks for visiting this nice and useful blog. As many events are about to happen soon. So we just want to share few things with all visitors as it might be helpful for everyone.

NSE and BSE are trading in range and we are expecting breakout in the market after budget. One should buy quality stocks at every decline and should exit long positions at every rise.

Regards
BUZZINGSTREET

Stock market investment if done with proper research and updated knowledge than it can give very lucrative results. There are four basic golden rules of stock market which are to be followed
(thebuzzingstreet1@gmail.com)http://www.buzzingstreet.com

buzzingstreet said...

Dear Visitor,
Market is showing some good move. Nifty traders are now confused if they should go short in Nifty from current level of 5400 or should go further long. NSE and BSE are the two major stock exchanges of Indian stock market.

Keeping in mind that many investors and traders are very much confused with the current market move, we have stared posting Free technical research reports
. These reports are highly accurate and are available for free.


Regards
BUZZINGSTREET

Stock market investment if done with proper research and updated knowledge than it can give very lucrative results. There are four basic golden rules of stock market which are to be followed
(thebuzzingstreet1@gmail.com)http://www.buzzingstreet.com

We will be discussing the various benefits of speed trading and its various coefficients using which one can make the most out of their investments in the Indian stock market including both Nifty and Sensex (NSE and BSE)

ShareTipsInfo said...

NSE and BSE have many listed stocks, Let

Sharetipsinfo research best profitable stocks for you.

Our accuracy speaks for us

sharetipsinfo said...

In this article we shall be discussing about the various ways in which one can make as much profits as maybe possible and how we can select securities to make investments. Investing in securities can be profitable only if investment is done with proper research

Tripti Oberoi said...

The information you have happy deepavali gif given is unbelievably gainful at all much a commitment of gratefulness is by and large to offer satisfying information to us.