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.

16 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

Pavel Slavětínský 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

Pavel Slavětínský said...

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

Anonymous 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.

Unknown said...

Softhax
Find best android iOS apps free now. Install them on your phone with easily simple steps. Free android games, free applications. WinZip Pro Crack With Activation Key

Eliza said...

Thank you very much for writing such an interesting article on this topic. This has really made me think and I hope to read more. rauchgaswärmetauscher

loolog said...

This has https://gmailinloggenn.nl/

HD Filme said...

thanks for this information i like this HD Filme

Digital Spiders said...

google work
Sub ITA

Laura Bush said...

I really appreciate your work which you have shared here about the best Voodoo Love Spells online. The article you have shared here is very informative and the points you have mentioned are very helpful. Thank you so much.best Voodoo Love Spells online

authenticlovespellscaster said...

I am very grateful that I got find some helpful content in this post. After reading it, I think that you have good knowledge about Psychics and Spell casters. Thanks for posting it. Keep it up. Bring Back Lost Lover Spells