How to check a string against the Windows dictionary?

人盡茶涼 提交于 2020-01-06 14:43:48

问题


How can you check if a certain string is in the Windows dictionary?

Or, in other words, how to you grab the entirety of the Windows dictionary, so you can set a new dictionary to have that content?


回答1:


For Windows 8 and Windows Server 2012 there is a Spelling Checking API, that can be consumed from VB.Net via COM.

There is a link to the Microsoft Word Dictionary format (.dic file) listed on Wotsit.org, unfortunately the site is currently unavailable (the link provided is via the Wayback machine).

Microsoft provide a Common Speller API (CSAPI) for Office spell checking, however it appears to require a third party dictionary.

Merriam-Webster provide an online Dictionary API which is free for non-commercial use.

Microsoft Small Basic provides a Dictionary API which connects to an online service and can be consumed from VB.Net, simply import the 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


来源:https://stackoverflow.com/questions/23201613/how-to-check-a-string-against-the-windows-dictionary

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!