1 Attachment(s)
[.NET 3.5+] Spell Checking Library
Attached is a library I created that uses a Google API to retrieve spelling suggestions for text. The attachment is a solution that will compile into a dll.
Here is an example:
Code:
Imports System.Globalization
Imports System.SpellChecking
Public Sub SpellCheck()
'//create the spell checking class
Using checker = New Checker(CultureInfo.CurrentCulture)
'//create the request
Dim request = New Request("The folloing text is a tst.")
request.Multilined = False
'//you can pass plain text to the check method if desired
Dim result = checker.Check(request)
'//check if the spell check errored
If result.Errored Then
Console.WriteLine("Spell check errored")
Else
If result.HasCorrections Then
'//loop through all the corrections
For Each c As Correction In result.Corrections
'//write out the word that the suggestions are for
Console.WriteLine("{0}:", c.Word)
If c.HasSuggestions Then
For Each s As Suggestion In c.Suggestions
'//write out each suggestion for the word
Console.WriteLine("{0}{1}", ControlChars.Tab, s.Value)
Next
Else
Console.WriteLine("{0}No suggestions", ControlChars.Tab)
End If
Next
Else
Console.WriteLine("No corrections")
End If
End If
End Using
End Sub
And this would be the output:
Code:
folloing:
fooling
filling
following
falling
felling
tst:
test
tat
ST
St
st
I'll leave it up to you to create your own spell checking user interface. As long as you or the user have an internet connection you can spell check.
Also note that, exposed in the Checker class, is a CheckAsync method so that you can asynchronously spell check. I have also completely documented every member so that nothing should be unclear.
Re: [.NET 3.5+] Spell Checking Library
Nice contribution there FA! Some people will find this useful.