vb.net - 如何检查给定的字符串是否是真实的单词?

标签 vb.net anagram

我正在编写一个程序来解决 Visual Basic 中的字谜问题。如何检查字谜解算器给出的字符串是否是真实单词?我知道我必须访问某种字典,但我不知道该怎么做?

我需要一个函数来检查单词以返回真/假 bool 值。这可能吗?

我在 Microsoft 的 VS2015 中使用 Visual Basic。

最佳答案

Hunspell 非常易于使用。

  • 通过 Nuget 安装 .net-library(在 Visual Studio 中打开项目,然后 > Extras > Nuget-Package-Manager -> Console,输入 Install-Package NHunspell)
  • 下载 .aiff 和 .dic 文件,请参阅 Hunspell 项目页面上的词典链接。将这些文件包含在您的项目中或使用绝对路径。

示例代码:

Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
    Using h As New NHunspell.Hunspell(
        "...path ...\en_US.aff",
        "...path ...\en_US.dic")
        Me.TextBox1.BackColor = If(h.Spell(Me.TextBox1.Text),
            Color.PaleGreen, Color.PeachPuff)
    End Using
End Sub

Hunspell

.net library NHunspell

NHunspell C# Code Samples

关于vb.net - 如何检查给定的字符串是否是真实的单词?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42232528/

相关文章:

python - 从单词列表创建字谜列表

vb.net - 克隆 Winform 控件

javascript - 使用 JQUERY 重置原始值时,DropDownList SelectedIndexChanged 不会执行

c# - 将 PHP HMAC SHA256 转换为 C#

python-3.x - Python - 比较 2 个单词并检查它们是否是变位词

python - Python 中的 Anagram 代码 - 将动态生成的字符串与 txt 文件进行比较

c# - 以编程方式删除 Windows Mobile 设备上的电子邮件和 SMS

vb.net - 帮助以窗口形式将复选框列添加到 DataGridView

algorithm - 如何生成不是现有单词的变位词的不存在单词?

c# - 如何在纯 C# 和 .Net 框架中编写 Anagram 生成器