 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
TestPilot
Joined: 26 Jun 2007 Posts: 52
|
Posted: Sun Mar 16, 2008 2:23 am Post subject: TypoHunter |
|
|
Regular expressions based on the fly typo fixer.
You can get script here:
http://www.autohotkey.net/~TePe/TypoHunter.ahk
It is not trying to fix all typos, only most popular one. It is not meant to fully replace spellchecker, but in the meantime, it works fine in places where is no spellchecker available, for example in a chat programs.
To check if it is working type "hte" and press Space.
New version: March 24, 2008.
* Lots of bugs fixed
* Code clean up and some minor optimizations
* Updated RegEx rules base with fresh one from Wikipedia:
-several false positives removed
-multiple RegEx optimizations
-few new typos recognized
Difference from AutoReplace
* TypoHunter rule base based on regular expressions. That mean that single rule can fix several typos in many different words. For example, | Code: | | find="\b(O|o|[Dd]iso|[Rr]eo)rgi?niz(e[ds]?|ing)\b" replace="$1rganiz$2" | will catch and fix typos in words like "orgnizing", "disorginize", "reorgnized", "reorginizing" and etc.
*Rule base itself is taken from AutoWikiBrowser software page. And Wikipedians check thousands of Wikipedia articles everyday using it, often expanding and improving it. Chances are, that by the time you are reading this someone already improved typo searching/fixing regular expressions in some way. It would take me less then 15 min to update script rules with fresh ones from Wikipedia.
*This script will correct your typos, not your style. It would not translate words spelled British/American way to opposed spelling. It would not "fix" words like "naive" or "melee" French way - both spellings are perfectly Ok in English. On the other hand, I will include French spelling regexes later for those who think they cool:)
*Lots of AutoReplace mistakes were corrected, we talking about rules that were replacing perfectly ok spelled word with one that misspelled or one that is spelled ok but have different meaning.
*9 different languages covered so far by Wikipedia regexes. If you are using more then one language, you might be able to modify this script to fix even more typos.
*As of now, there is no easy way to add new rules, like one with Win+H key in AutoReplace.
This is early beta. So far it was not fully tested.
Bugs/ToDo:
Script now checking only one word - there are some rules that looking to fix two-word typos.
Replace only letters that need to be replaced(i.e. only part of the word that was misspelled, not whole word).
French spelling rules.
In case you improved script in any way you can try to upload it here:
http://en.wikipedia.org/w/index.php?title=User:TestPilot/TypoHunter&action=edit
Last edited by TestPilot on Sun May 11, 2008 1:51 pm; edited 4 times in total |
|
| Back to top |
|
 |
Neofate
Joined: 16 Mar 2008 Posts: 1 Location: USA
|
Posted: Sun Mar 16, 2008 5:34 pm Post subject: |
|
|
Nice -- but call me an idiot, I'm new to AHK. How do I run the program? I have it loaded, but no clue on how to get it to correct.
Nevermind as I type this I see it autocorrecting words.. it just isn't smart enough at this time to catch alot of errors.. but the ones it does are great. Very neat. Thanks. _________________ Neo |
|
| Back to top |
|
 |
trik
Joined: 15 Jul 2007 Posts: 1320
|
Posted: Sun Mar 16, 2008 6:28 pm Post subject: |
|
|
| Impressive, but I think you could really improve it by not using the backscape key to delete words. |
|
| Back to top |
|
 |
TestPilot
Joined: 26 Jun 2007 Posts: 52
|
Posted: Sun Mar 16, 2008 9:54 pm Post subject: |
|
|
| Neofate wrote: |
Nevermind as I type this I see it autocorrecting words.. it just isn't smart enough at this time to catch alot of errors.. |
Yeah, it not meant to replace spellchecker. It is correcting several thousands typos, ~15k-20k words, supposedly most common ones. Taking into account that number of possible typos astronomical, it could not ever come close to correcting every one you make. But on the other hand, it strike pretty often. Good enough to catch a lot of mine typos and tons of typos general public make while editing Wikipedia articles. And don't forget, lots of typos not corrected because it is not clear what word user wanted on the first place. That is why your spellchecker often give you more then one possible correction of mistyped word. It better to leave mistyped word as it is, rather then "correct" it wrong way and leave user without a chance of correcting mistake with general purpose spellchecker.
| Ian wrote: |
Impressive, but I think you could really improve it by not using the backscape key to delete words. |
This way is ensuring universal compatibility - it really works in weird palaces, like online games chat messages, for example. Especially MMORPG, where you have to chat to people all the time, unless you on "vent" (i.e. Ventrilo, currently leading VoIP soft for online gaming) with your guild/friends. And we talking about graphical interfaces that have nothing common with general Windows applications and written from scratch. And it really fast - it fix your word in a blink of an eye. You have to see that - try it!  |
|
| Back to top |
|
 |
Oberon
Joined: 18 Feb 2008 Posts: 442
|
Posted: Sun Mar 16, 2008 10:22 pm Post subject: |
|
|
You can combine a lot of the hotkeys like...
| Code: | $1::
WordReset("1")
return
$2::
WordReset("2")
return
$3::
WordReset("3")
return |
To: | Code: | $1::
$2::
$3::
WordReset(SubStr(A_ThisHotkey, 2))
Return |
|
|
| Back to top |
|
 |
TestPilot
Joined: 26 Jun 2007 Posts: 52
|
Posted: Tue Mar 25, 2008 2:24 am Post subject: |
|
|
New version. Changes described in first post.
Can someone look - I copy pasted "Win+H" part from AutoReplace. It works fine by itself but typos it adding are not working for some reason. Could that somehow be fixed?
Oberon
WordReset() was fixed in a new version. It might be a good idea to do letters that way. On the other hand, I not sure, it will make extra function, SubStr(), to execute each time user press a button. |
|
| Back to top |
|
 |
Ninefingers
Joined: 25 Mar 2008 Posts: 2 Location: Kansas
|
Posted: Tue Mar 25, 2008 5:19 pm Post subject: CAPSLOCK |
|
|
I am an Aeronautical Engineer and this script looks like it would be very handy for reducing typos on our engineering drawings.
The problem is, all text on our drawings is required to be uppercase. This script doesn't seem to work with the capslock on.
Could it be modified to be insensitive to case, and would it be practical? |
|
| Back to top |
|
 |
BoBoĻ Guest
|
Posted: Tue Mar 25, 2008 5:32 pm Post subject: |
|
|
@ Ninefingers
Haven't seen the code, but check out AHKs StringUpper. If used on the output, it might solve your requirement. Good luck.  |
|
| Back to top |
|
 |
TestPilot
Joined: 26 Jun 2007 Posts: 52
|
Posted: Tue Mar 25, 2008 6:33 pm Post subject: Re: CAPSLOCK |
|
|
| Ninefingers wrote: | I am an Aeronautical Engineer and this script looks like it would be very handy for reducing typos on our engineering drawings.
The problem is, all text on our drawings is required to be uppercase. This script doesn't seem to work with the capslock on.
Could it be modified to be insensitive to case, and would it be practical? |
Here: http://www.autohotkey.net/~TePe/TypoHunterUpperCase.ahk
That was very easy. I made it to fix any typo in case Caps Lock is active. It would not only correct typos, but also make sure outcome is in upper case. Fixing mONDAY-->MONDAY, for example. On the other hand, in any application that don't need everything in upper case (emails, text editors, browsers), it will work as before, leaving just first letter capitalized in case user started new sentence or capitalizing first letters of weekdays/months/countries and some companies names...
I could modify main script so it would catch&fix typos like ASLO or HTE and etc. even if user types them by holding shrift, but problem that it could be legitimate abbreviation in general text, look for example here or here.
P.S. And in case you don't like it fixing capitalization typos described above - change
| Code: | | StringCaseSense, On |
to
| Code: | | StringCaseSense, Off |
|
|
| Back to top |
|
 |
Ninefingers
Joined: 25 Mar 2008 Posts: 2 Location: Kansas
|
Posted: Wed Mar 26, 2008 7:27 pm Post subject: Thanks |
|
|
| Thank you very much. |
|
| 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
|