views:

150

answers:

1

Hi, I am doing a web based chattebot system and my problems are these.

  • I need to get a particular user question and check for some specific keywords in it(for example take the nouns) and find for synonyms and well as do the spell check?

Therefore What is the best C# API for wordnet?? Well what I want to do is get a sentence from a textbox and use it for synonym and spell check and there is both c# ASP and standalone app APIs on the wrodnet site.What is the best way?

Can I do both spell check and synonym check using wordnet and the other c# API??

I would be grateful if you could give me some solutions.

Thanks a lot.

A: 

If you can I would use the WPF built in spell checker, just add a reference to PresentationFramework in your ASP.NET project and you can programmatically create a WPF text box to use for spell check etc.

    List<string> getSuggestions(string text)
    {
        System.Windows.Controls.TextBox wpfTextBox = new System.Windows.Controls.TextBox();
        wpfTextBox.AcceptsReturn = true;
        wpfTextBox.AcceptsTab = true;
        wpfTextBox.SpellCheck.IsEnabled = true;
        wpfTextBox.Text = text;

        int index = 0;
        List<string> suggestions = new List<string>();

        while ((index = wpfTextBox.GetNextSpellingErrorCharacterIndex(index, System.Windows.Documents.LogicalDirection.Forward)) != -1)
        {
            string currentError = wpfTextBox.Text.Substring(index, wpfTextBox.GetSpellingErrorLength(index));
            suggestions.Add(currentError);

            foreach (string suggestion in wpfTextBox.GetSpellingError(index).Suggestions)
            {
                suggestions.Add(suggestion);
            }
        }
        return suggestions;
    }
BrokenGlass
This may be what the OP is looking for, but I'd still like to know a good C# API for wordnet. I tried a couple for Python, but it's not really my language.
harpo
hi, thanks for the reply...but I did not really got this....Did ya mean I can use the framwork spell checker for my purpose.Well that would be grate then.Does this appears on the web interface it self when the user types?? Or can I use the same spell checker to process the string inside the text box then then tell the user typing is not correct and all that??And any solutions for c# API for wordnet??
sunshine
yes you can use the WPF framework spell checker programmatically in your C# code, of course how you want to use the results depends on you, i.e. you can display them dynamically by updating the UI with suggestions using javascript/AJAX calls.
BrokenGlass
I tried using the code referring to the Presentation Framework but as I am running this code in a web page code behind it gives me errors.Can the same work be done in a asp.net web page as well? And also is there any inbuilt dictionaries for synonym check as well instead of using wordnet??
sunshine
did you add a reference to PresentationFramework to your framework? (Add reference..|.NET tab|PresentationFramework). Also your project should be .NET 4.0
BrokenGlass
oh no I am working on Visual Studio 2005.Is there any options in it for the spell and synonym check?Any inbuilt dictionary in .NET 2005??Any ideas for wordnet?
sunshine