2

我正在做一个基于网络的聊天机器人系统,我的问题是这些。

  • 我需要获取一个特定的用户问题并检查其中的一些特定关键字(例如取名词)并查找同义词并进行拼写检查?

因此,wordnet 的最佳 C# API 是什么?好吧,我想做的是从文本框中获取一个句子并将其用于同义词和拼写检查,并且 wrodnet 站点上有 c# ASP 和独立应用程序 API。最好的方法是什么?

我可以使用 wordnet 和其他 c# API 进行拼写检查和同义词检查吗?

如果您能给我一些解决方案,我将不胜感激。

非常感谢。

4

2 回答 2

1

如果可以的话,我会使用 WPF 内置的拼写检查器,只需PresentationFramework在您的 ASP.NET 项目中添加对的引用,您就可以以编程方式创建一个 WPF 文本框以用于拼写检查等。

    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;
    }
于 2010-09-17T18:16:35.157 回答
1

此处列出的 API:http ://wordnet.princeton.edu/wordnet/related-projects/#.NET,Matt Gerber 的 ( http://ptl.sys.virginia.edu/ptl/members/matthew-gerber/software #WordNet_API)是最好的。

这不是一个很好的 API,但它工作正常,这是我需要的一个好的开始。

我还没有尝试过Proxem 的 Antelope,因为它看起来更像是一个重量级的应用程序,而不是一个简单的 API。不过,它可能更加健壮,解析引擎可能对您正在做的事情非常有用。

于 2011-12-16T18:19:45.533 回答