如何根据Windows字典检查字符串?

时间:2014-04-21 16:40:04

标签: vb.net .net-4.0 spell-checking

如何检查Windows字典中是否有某个字符串?

或者,换句话说,如何获取整个Windows字典,以便设置一个新的字典来获取该内容?

1 个答案:

答案 0 :(得分:1)

对于Windows 8和Windows Server 2012,有一个Spelling Checking API,可以通过COM从VB.Net中使用。

Wotsit.org上列出了Microsoft Word字典格式(.dic文件)的链接,遗憾的是该网站目前无法使用(提供的链接是通过Wayback机器)。

Microsoft提供Common Speller API (CSAPI) for Office spell checking,但它似乎需要第三方字典。

Merriam-Webster提供在线Dictionary API,可免费用于非商业用途。

Microsoft Small Basic提供Dictionary API连接到在线服务,可以从VB.Net中使用,只需导入SmallBasicLibrary.dll。

Imports Microsoft.SmallBasic.Library

Module MyModule

    Sub Main()
        Dim definition = Dictionary.GetDefinition("vowel")
        ' A string is returned if the word exists in the dictionary
        Console.WriteLine(CStr(definition))
    End Sub

End Module