AutoHotkey Community

It is currently May 26th, 2012, 4:35 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: TypoHunter
PostPosted: March 16th, 2008, 3:23 am 
Offline

Joined: June 26th, 2007, 7:43 am
Posts: 52
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?tit ... ction=edit


Last edited by TestPilot on May 11th, 2008, 2:51 pm, edited 4 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2008, 6:34 pm 
Offline

Joined: March 16th, 2008, 6:32 pm
Posts: 1
Location: USA
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2008, 7:28 pm 
Offline

Joined: July 15th, 2007, 1:43 am
Posts: 1320
Impressive, but I think you could really improve it by not using the backscape key to delete words.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2008, 10:54 pm 
Offline

Joined: June 26th, 2007, 7:43 am
Posts: 52
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! :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2008, 11:22 pm 
Offline

Joined: February 18th, 2008, 8:26 pm
Posts: 442
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 25th, 2008, 3:24 am 
Offline

Joined: June 26th, 2007, 7:43 am
Posts: 52
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: CAPSLOCK
PostPosted: March 25th, 2008, 6:19 pm 
Offline

Joined: March 25th, 2008, 6:09 pm
Posts: 2
Location: Kansas
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 25th, 2008, 6:32 pm 
@ Ninefingers
Haven't seen the code, but check out AHKs StringUpper. If used on the output, it might solve your requirement. Good luck. 8)


Report this post
Top
  
Reply with quote  
 Post subject: Re: CAPSLOCK
PostPosted: March 25th, 2008, 7:33 pm 
Offline

Joined: June 26th, 2007, 7:43 am
Posts: 52
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Thanks
PostPosted: March 26th, 2008, 8:27 pm 
Offline

Joined: March 25th, 2008, 6:09 pm
Posts: 2
Location: Kansas
Thank you very much.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: JamixZol and 15 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group