bug in NHunspell spelling checker

Posted by Nikhil K on Stack Overflow See other posts from Stack Overflow or by Nikhil K
Published on 2010-04-22T15:54:15Z Indexed on 2010/04/22 16:03 UTC
Read the original article Hit count: 329

Filed under:

I am using NHunspell for checking spelling.I added NHunspell.dll as a reference to my asp.net page.I added the namespace System.NHunspell. The problem i am facing is related to IDisposible. I put the downloaded code of NHunspell inside the button event.

protected void Button1_Click(object sender, EventArgs e) {

        using (Hunspell hunspell = new Hunspell("en_us.aff", "en_us.dic"))
        {
            bool correct = hunspell.Spell("Recommendation");
            var suggestions = hunspell.Suggest("Recommendatio");
            foreach (string suggestion in suggestions)
            {
                Console.WriteLine("Suggestion is: " + suggestion);
            }
        }

        // Hyphen
        using (Hyphen hyphen = new Hyphen("hyph_en_us.dic"))
        {
            var hyphenated = hyphen.Hyphenate("Recommendation");
        }


*  using (MyThes thes = new MyThes("th_en_us_new.idx", "th_en_us_new.dat"))
        {
            using (Hunspell hunspell = new Hunspell("en_us.aff", "en_us.dic"))
            {
                ThesResult tr = thes.Lookup("cars", hunspell);
                foreach (ThesMeaning meaning in tr.Meanings)
                {
                    Console.WriteLine("  Meaning: " + meaning.Description);
                    foreach (string synonym in meaning.Synonyms)
                    {
                        Console.WriteLine("    Synonym: " + synonym);

                    }
                }
            }


        }

The * shown above is the line of error.The error is: " type used in a using statement must be implicitly convertible to 'System.IDisposable'".

Also there is a warning on that line :"'NHunspell.MyThes.MyThes(string, string)' is obsolete: 'idx File is not longer needed, MyThes works completely in memory'";

Can any one help me to correct this???

© Stack Overflow or respective owner

Related posts about c#