 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
ahknice Guest
|
Posted: Thu Mar 05, 2009 11:12 pm Post subject: auto correct request |
|
|
Can somebody please write a code that will autocorrect mispelled words checking from a list of correct words.
Say when you type "voer" it will change to "over", "yhou" to "you" and "hte" to "the".
And you don't have to do it like ::voer::over and ::yhou::you or ::hte::the.
But will just detect words not in the list (separate file) and intelligently match it to closest correct word.
I see this feature in some of the more common auto correct software in the market but need one that's free and possibly born out of the fabulous AHK.
Please can somebody write a code as I'm level 0 in scripting. |
|
| Back to top |
|
 |
evan
Joined: 19 Feb 2009 Posts: 125
|
Posted: Thu Mar 05, 2009 11:19 pm Post subject: |
|
|
so basically are u referring to the spell check system like microsoft word or firefox? or are u talking about when u type words wrong, it will instantly replace with the correct one like hotstring?
and second question, where do u usually type that the program doesnt have spellcheck function build-in? |
|
| Back to top |
|
 |
ahknice Guest
|
Posted: Thu Mar 05, 2009 11:52 pm Post subject: |
|
|
I'm typing in a form, like here where we post topics, web form I guess you can call it that. The spell check is from Firefox, "check my spelling as I type".
I've made use of ahk auto complete where I can have ::btw::by the way.
What I'm looking for now is to "auto correct" misspelled words 'cause I suck at typing big time.
The program I have in use now is the one I downloaded here, the ahk auto complete, one with entries from wikipedia, foreign words with accents, changing of ign to ing, the Win+H to enter misspelling correction etc.
Basically I'm looking for auto correct not auto complete. |
|
| Back to top |
|
 |
evan
Joined: 19 Feb 2009 Posts: 125
|
Posted: Fri Mar 06, 2009 12:00 am Post subject: |
|
|
given the examples u provide:
voer, yhou and hte
how do u determine "the closest" spelling
for example:
voer can be voar (misspell a to e), can be over (misspell ov to vo)
yhou can be you (misspell one extra h), can be thou (misspell t to u)
hte can be the (misspell th to ht), can be ate (misspell a to h)
here are just few examples, i am sure if one checks carefully, there might be a lot of combination for each word
(thats the reason why firefox or microsoft word provide suggestion words instead of auto correct. and for the auto correct function in microsoft, u actually input the list each by each just like ::yhou::you)
here is what i meant in microsoft word:
 |
|
| Back to top |
|
 |
evan
Joined: 19 Feb 2009 Posts: 125
|
Posted: Fri Mar 06, 2009 12:13 am Post subject: |
|
|
this will be a quick way how u can add words immediately:
| Code: |
#SingleInstance force
^q::
Gui, add, edit, w100 vwrong,
GUi, add, edit, w100 vcorrect,
Gui, add, button, w50 gok, OK
gui, show
return
ok:
Gui, submit
change = ::%wrong%::%correct%
FileAppend, `n%change%, %A_ScriptFullPath%
sleep 500
reload
return |
|
|
| Back to top |
|
 |
jmanx
Joined: 14 May 2008 Posts: 110
|
Posted: Fri Mar 06, 2009 12:19 am Post subject: |
|
|
this should work in real-time but, you have to add all the incorrect spelling's yourself.
so basically what you're gonna do is this
| Code: | :*?:(incorrect spelling)::(correct spelling)
|
This will remove the word you typed and replace it with the word you want it to
It also doesn't have to be the incorrect spelling into the correct way, anything will work
example:
| Code: | :*?:chicken::french fries
|
________
Cb1300
Last edited by jmanx on Thu Feb 10, 2011 8:42 pm; edited 1 time in total |
|
| Back to top |
|
 |
flyingDman
Joined: 27 Feb 2009 Posts: 690 Location: Burbank, California
|
Posted: Fri Mar 06, 2009 12:31 am Post subject: Re: auto correct request |
|
|
| ahknice wrote: | Can somebody please write a code that will autocorrect mispelled words checking from a list of correct words.
Say when you type "voer" it will change to "over", "yhou" to "you" and "hte" to "the".
And you don't have to do it like ::voer::over and ::yhou::you or ::hte::the.
But will just detect words not in the list (separate file) and intelligently match it to closest correct word.
I see this feature in some of the more common auto correct software in the market but need one that's free and possibly born out of the fabulous AHK.
Please can somebody write a code as I'm level 0 in scripting. |
Have you looked at http://www.autohotkey.com/download/AutoCorrect.ahk. I use it all the time. Works great! |
|
| Back to top |
|
 |
tidbit
Joined: 09 Mar 2008 Posts: 1807 Location: Minnesota, USA
|
Posted: Fri Mar 06, 2009 2:36 am Post subject: |
|
|
Look all throughout this topic: http://www.autohotkey.com/forum/viewtopic.php?t=8057&highlight=auto+correct .
there are several libraries in that topic, mix/match/edit them for your likings. plus you can easly add/remove them on the fly with win+H. _________________ rawr. be very afraid
*poke*
Note: My name is all lowercase for a reason.
Even monkeys fall from trees. - Japanese proverb |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Mar 06, 2009 9:11 am Post subject: |
|
|
| what's this :*?: |
|
| Back to top |
|
 |
ahknice Guest
|
Posted: Fri Mar 06, 2009 12:58 pm Post subject: |
|
|
evan, nice way to add, can you please edit it so I don't have to "tab" to go to OK or click the OK button to send. Can I just, after filling the second field, can enter/send from there.
jmanx, I understand :*?: means it will replace without first pressing on space. It's actually nice. I can use this.
flyingDman and tidbit, I'm sorry I don't have my facts straight. Actually I downloaded the autocorrect.ahk not "auto complete", which I mentioned earlier with entries from wikipedia, foreign words with accent, changing of win +H feature and some correction entries e.g. ::memeber::member. Correction worked great but need to add in more.
| Quote: | | The program I have in use now is the one I downloaded here, the ahk auto complete |
|
|
| Back to top |
|
 |
ahknice Guest
|
Posted: Sat Mar 07, 2009 3:12 pm Post subject: |
|
|
evan can you please edit the code that will, I have a work flow in mind but don't know how to edit or where to insert from your code. Basically, the work flow goes like this:
0a. "first I will highlight an entry from a list and copy it" (then comes your script)
CODE:
1. paste in field 1 and field 2.
2. click on OK button.
I find this will be easier to manage after I'm gonna run this with VBA macro to arrange them as opposed to individually filling each field, as shown below
 |
|
| Back to top |
|
 |
evan
Joined: 19 Feb 2009 Posts: 125
|
Posted: Sat Mar 07, 2009 6:07 pm Post subject: |
|
|
if u have a list like:
wrong=correct
then u can just use the following fuction to add the list in corrected format "::wrong::correct" at the end of the script:
| Code: | var=
(
ablre=able
ahppy=happy
ands=and
appointmetn=appointment
aroudn=around
arrivied=arrived
buyt=but
)
StringReplace, var, var, `=, ::, All
loop, parse, var, `n, `r
{
list=%list%`n::%A_LoopField%
}
clipboard = %list%
msgbox, List saved in clipboard:`n %list%
|
and here is a modification that does not require u to click OK at the end:
| Code: | #SingleInstance force
Gui, add, edit, w100 vwrong,
GUi, add, edit, w100 vcorrect,
Gui, add, button, w50 gok, OK
^q::
Hotkey, Enter, label
gui, show
return
label:
ok:
Gui, submit
change = ::%wrong%::%correct%
FileAppend, `n%change%, %A_ScriptFullPath%
sleep 500
reload
return
Guiclose:
Hotkey, Enter, off
Gui, hide
return |
|
|
| Back to top |
|
 |
ahknice Guest
|
Posted: Sun Mar 08, 2009 12:27 am Post subject: |
|
|
It's lovely. Now I don't have to individually highlight, copy, run script. Just run new script and walah I got myself a list.
Although when I paste it to notepad it looked like this,
::ablre::able::alos::also::ansd::and::nad::and::appointmetn::appointment
I pasted it to Word,
::ablre::able
::alos::also
::ansd::and
::nad::and
::appointmetn::appointment
::aroudn::around
::arpund::around
::arrvied::arrived
But it's fine. I can always go to Word to have it arranged like so. And this is way, way better. Thanks evan dear . |
|
| Back to top |
|
 |
ahknice Guest
|
Posted: Sun Mar 08, 2009 1:36 am Post subject: |
|
|
Well actually I'm still hoping that someone could sort of like crack the code or write a code that will auto correct much like a program I have, which is a trial. I really hope ahk can do this.
What the software does is it corrects (1) interactively and (2) automatically.
This one below auto corrects interactively, (asking you to choose from a list of suggestions):
This one below auto corrects automatically. It chooses the FIRST suggestion, if you notice:
My wish is to have the code auto correct automatically, intelligently match typo word to closest correct word. I hope somebody can write the code please. |
|
| Back to top |
|
 |
jmanx
Joined: 14 May 2008 Posts: 110
|
Posted: Sun Mar 08, 2009 2:27 am Post subject: |
|
|
here's a small script I wrote for an auto correct list on wikipedia that has more than 4k+ corrections
| Code: | MyFileLocation=%A_desktop%\Corrections.txt
filedelete, %A_desktop%\AutoCorrect.ahk
int=0
loop, read, %MyFileLocation%
{
currentline:=A_Loopreadline
stringreplace, currentline, currentline, ->, ::
fileappend, :*?:%currentline%`n, %A_desktop%\AutoCorrect.ahk
int++
}
|
here's a link to the list, just put your caret at the top, scroll all the way down, then whild holding shift, highlight the entire list in 1 click.
Then save in a .txt
http://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
________
Arizona Medical Marijuana Dispensaries
Last edited by jmanx on Thu Feb 10, 2011 8:42 pm; edited 1 time in total |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|