Free Word suggestion/Auto correct

Please post all your completed software applications in here. This is for full software which you have created and wish to release and share with everyone.
4 posts Page 1 of 1
Contributors
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

Free Word suggestion/Auto correct
MrAksel
Hi everybody, I got the idea of an word suggestion program when I replied to viewtopic.php?f=32&t=9197#p67218
I have sort of improved that algorithm now, though its running slower it will match words more correctly.
I have included the DLL and the source of a demo program (written in C#) below. You can convert the demo program to VB at http://www.developerfusion.com/tools/co ... arp-to-vb/
There is also a list of 172804 words that you can load into the Suggester.
To use the library, create a new instance of AutoCorrect.Suggester. Here you can pass the words that are to be loaded. You can also use AddWords later to add one or more words.
The second parameter is a Dictionary<String, Int32> which is used to add points to a word. The String is a word, and the Int32 is an amount of points that is added to its matching word for each search.
Example:
Code: Select all
Dim Words As String() = New String () {"Hello", "Chords", "Smilies", "Google"}
Dim Points As New Dictionary(Of String, Integer)
Points.Add("Hello", 3) 'Hello will have 3 more points'
Points.Add("Chords", 2) 'Chords will have 2 more points'

Dim s As New AutoCorrect.Suggester(Words, Points)
s.AddWords("Message") 'Add the word Message'
s.AddWords("Preview", "Save", "Submit") 'Add Preview, Save and Submit'
s.AddPoints("Preview", 5) 'Add 5 points to Preview'

MessageBox.Show("'Helo' matches '" + s.SuggestFromString("Helo") + "'.")
MessageBox.Show("'Gogle' matches '" + s.SuggestFromString("Gogle") + "'.")

s.SetPoints("Hello", -50) 'Make sure Hello does not match by setting it to a low score'
MessageBox.Show("'Helo' matches '" + s.SuggestFromString("Helo") + "'.")

'Get a list containing every result'
Dim Results As List(Of KeyValuePair(Of String, Integer)) = s.SuggestionsFromString("Subit")
For Each result As KeyValuePair(Of String, Integer) In Results
  MessageBox.Show(result.Key + " had " + result.Value.ToString() + " points.")
Next

'Get a list containing every result, now optimizing speed by setting the third parameter to AutoCorrect.SpeedAccuracy.Speed. Default is AutoCorrect.SpeedAccuracy.Accuracy'
'The second parameter is an option to return if the word has been found, or continue searching through the whole list. Default is true.'
Results = s.SuggestionsFromString("Mesage", true, AutoCorrect.SpeedAccuracy.Speed)
For Each result As KeyValuePair(Of String, Integer) In Results
  MessageBox.Show(result.Key + " had " + result.Value.ToString() + " points.")
Next
You do not have the required permissions to view the files attached to this post.
Last edited by MrAksel on Sun May 20, 2012 6:28 pm, edited 3 times in total.
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
Codex
Coding God
Coding God
Posts: 2028
Joined: Wed Mar 31, 2010 5:50 pm

Re: Word suggestion/Auto correct
Codex
hmm, Nice cooll;
This just gave me a good idea about a feature project.
I have never used Dictionary in VB before, so it's like a challenge for me :)
We shall let the revolution begin.. the revolution for freedom, freedom against censorship. We shall fight in the fields and in the streets, we shall fight in the hills; we shall never surrender
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

Re: Word suggestion/Auto correct
MrAksel
I'm glad you liked it :) What new project did you think of?
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
Codex
Coding God
Coding God
Posts: 2028
Joined: Wed Mar 31, 2010 5:50 pm

Re: Word suggestion/Auto correct
Codex
MrAksel wrote:
I'm glad you liked it :) What new project did you think of?
It's a secret one, lol, if it ever gets released you will get to know what it is :D
We shall let the revolution begin.. the revolution for freedom, freedom against censorship. We shall fight in the fields and in the streets, we shall fight in the hills; we shall never surrender
4 posts Page 1 of 1
Return to “Full Software”