topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday March 29, 2024, 10:31 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: AutoHotKey text replacement question  (Read 6134 times)

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • View Profile
    • Donate to Member
AutoHotKey text replacement question
« on: June 27, 2015, 04:05 PM »
I belong to a forum where a lot of amateur writers gather. They're wanting a script that will catch misspellings as they type. I'm developing a simple script that replaces the wrong wording with the correct wording. For example:

::good advise::good advice

The above works flawlessly: as soon as a user types "good advise" it gets changed by the script to "good advice" and the user just keeps on typing.

I want the script to detect anytime the writer types the article 'a' and the next word begins with a vowel. In that case, I want the script to change 'a' to 'an'. So, below shows what the author types and then after the arrow I show the correction made by the script:

a otter -> an otter

a icycle -> an icycle

Any help would be appreciated.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: AutoHotKey text replacement question
« Reply #1 on: June 28, 2015, 12:53 AM »
@kyrathaba: If you're using Autohotkey to develop the auto-correct script, you can look up Hotstrings.


for starters, you can use something like this below though it is not accurate due to examples such as "an umbrella" vs. "a university".

Code: Autohotkey [Select]
  1. :*:a a::an a
  2. :*:a e::an e
  3. :*:a i::an i
  4. :*:a o::an o
  5. :*:a u::an u

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • View Profile
    • Donate to Member
Re: AutoHotKey text replacement question
« Reply #2 on: June 28, 2015, 08:49 AM »
Thanks, Lanux!

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: AutoHotKey text replacement question
« Reply #3 on: June 28, 2015, 09:05 AM »
@kyrathaba: If you're using Autohotkey to develop the auto-correct script, you can look up Hotstrings.


for starters, you can use something like this below though it is not accurate due to examples such as "an umbrella" vs. "a university".


Also "a hour"

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • View Profile
    • Donate to Member
Re: AutoHotKey text replacement question
« Reply #4 on: June 28, 2015, 09:06 AM »
Thanks, MilesAhead. Good catch! I'll add that in my script.

kunkel321

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 597
    • View Profile
    • Donate to Member
Re: AutoHotKey text replacement question
« Reply #5 on: June 29, 2015, 10:15 AM »
Man I gotta learn to do ahk programming....  I don't think that computer programmers appreciate just how confusing this stuff is to us lehhfolks.
Anyway.  I remember a few years ago, finding a script that someone had already written that does autocorrects.  Here I just now found this article about it.
http://www.howtogeek...ions-on-your-system/
I think it's been updated a few times, so google it and get the latest version.  If my memory is correct, they integrated some wikipedia list of "most common English typos" or some kind of thing.... 

Also, the a/an situation is difficult.  There are lots of exceptions. 

I also googled that.   
https://www.google.c...a+grammar+exceptions

From here: https://owl.english....owl/resource/591/01/

Exceptions
Use "an" before unsounded "h." Because the "h" hasn't any phonetic representation and has no audible sound, the sound that follows the article is a vowel; consequently, "an" is used.

an honorable peace
an honest error
When "u" makes the same sound as the "y" in "you," or "o" makes the same sound as "w" in "won," then a is used. The word-initial "y" sound ("unicorn") is actually a glide [j] phonetically, which has consonantal properties; consequently, it is treated as a consonant, requiring "a."

a union
a united front
a unicorn
a used napkin
a U.S. ship
a one-legged man

 

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: AutoHotKey text replacement question
« Reply #6 on: June 29, 2015, 12:42 PM »
Anyway.  I remember a few years ago, finding a script that someone had already written that does autocorrects.

The other tough thing is a free grammar checker that doesn't crash the editor you are using it in. I tried Ginger and a couple of others.  Nothing really amazed me.  It seemed the better the program handled the grammar the more unstable it was.  Trying to brush up with online lessons is discouraging.  So many exceptions and bizarre rules.  I don't remember it being that complex when I was in grammar school.  :)

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • View Profile
    • Donate to Member
Re: AutoHotKey text replacement question
« Reply #7 on: June 29, 2015, 02:22 PM »
Thanks, kunkel. Added those exceptions.