How to use C # NHunspell, how to check words?

Using C # NHunspell, how to check the spelling of a word, and if not the correct spelling?

I imported NHunspell.dll into the project. And looked at the documentation .

But, being a little new in the documentation for reading, it’s hard to figure out where to start. Can someone give an example of how to check the spelling of a word? Basically, I need Helloworld for NHunspell.

+5
source share
1 answer
using (Hunspell hunspell = new Hunspell("en_us.aff", "en_us.dic"))
{
    Console.WriteLine("Hunspell - Spell Checking Functions");
    Console.WriteLine("¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯");

    Console.WriteLine("Check if the word 'Recommendation' is spelled correct"); 
    bool correct = hunspell.Spell("Recommendation");
    Console.WriteLine("Recommendation is spelled " + 
       (correct ? "correct":"not correct"));

    Console.WriteLine("");
    Console.WriteLine("Make suggestions for the word 'Recommendatio'");
    List<string> suggestions = hunspell.Suggest("Recommendatio");
    Console.WriteLine("There are " + 
       suggestions.Count.ToString() + " suggestions" );
    foreach (string suggestion in suggestions)
    {
        Console.WriteLine("Suggestion is: " + suggestion );
    }
}

From the article http://www.codeproject.com/Articles/43495/Spell-Check-Hyphenation-and-Thesaurus-for-NET-with

+8
source

All Articles