AutoCorrect for v2

Post your working scripts, libraries and tools.
kashmirLZ
Posts: 48
Joined: 06 Oct 2022, 23:27

Re: AutoCorrect for v2

07 Apr 2024, 02:05

Yeah some shouldn't be there, like:
::it's final::its final
User avatar
kunkel321
Posts: 1062
Joined: 30 Nov 2015, 21:19

Re: AutoCorrect for v2

07 Apr 2024, 09:10

@willwade Very cool! I suspect that this is well beyond my coding abilities, but I am interested... I supposed this is another reason for me to get set up on GitHub... The forum posts here have a size limit, on zip files, of 2 MB. As it is now, I have to use 7z files, because the zips turn out too big. Another fellow, Jason, also suggested GitHub. He had some changes he wanted to make...

I see the model you linked include homophones... That's cool. I also was tinkering with the idea of using these, but I wasn't sure how.

EDIT: Possibly relevant... Near the bottom of this post:
viewtopic.php?f=83&t=120220#p542691
I talk about the "Log Of Errors" script.
...This constantly records keyboard input, but has a really short memory. It remembers approximately the last 7 words typed, and (on BS) logs them along with the autocorrect that was just triggered...
I got rid of that, combining some of the functionality into the current "AutoCorrectsLog."

Anyhow... It wasn't part of the HotString Helper 2.0 tool. Rather it was made to record some of the context of the sentence I was typing, when an autocorrection misfired, and got logged for later analysis. I wonder if something similar could be used here though... Typically, when hh2 is launched, a user will have only selected a single mistyped/misspelled word. A single word might not be enough context for the language model to work, but if several of the preceding words were available, it might give better results.. Actually, as I type this, it occurs to me that the current "Google, did you mean.." code would probably benefit from that as well.
ste(phen|ve) kunkel
User avatar
kunkel321
Posts: 1062
Joined: 30 Nov 2015, 21:19

Re: AutoCorrect for v2

07 Apr 2024, 10:17

Hi @Jasonosaj / @xenspidey / @willwade ,
Can you guys recommend any good support forums for learning GitHub... Especially for using VSCode with GitHub?
ste(phen|ve) kunkel
willwade
Posts: 9
Joined: 21 Feb 2017, 08:52
Contact:

Re: AutoCorrect for v2

07 Apr 2024, 15:12

kunkel321 wrote:
07 Apr 2024, 10:17
Hi @Jasonosaj / @xenspidey / @willwade ,
Can you guys recommend any good support forums for learning GitHub... Especially for using VSCode with GitHub?
Just download https://desktop.github.com and once you have an account go to the app and File-> New repository -> select your path to your code

Then once happy press Push in the top right
User avatar
kunkel321
Posts: 1062
Joined: 30 Nov 2015, 21:19

Re: AutoCorrect for v2

08 Apr 2024, 10:25

willwade wrote:
07 Apr 2024, 15:12
kunkel321 wrote:
07 Apr 2024, 10:17
Hi @Jasonosaj / @xenspidey / @willwade ,
Can you guys recommend any good support forums for learning GitHub... Especially for using VSCode with GitHub?
Just download https://desktop.github.com and once you have an account go to the app and File-> New repository -> select your path to your code
Then once happy press Push in the top right
Thanks for the tips. I'm moving the Git part of this discussion to the "off-topic" subforum, so we don't have a bunch of clutter in this (v2 scripts) sub forum...
@Jasonosaj / @xenspidey / @willwade
viewtopic.php?f=17&t=128467
ste(phen|ve) kunkel
User avatar
kunkel321
Posts: 1062
Joined: 30 Nov 2015, 21:19

Re: AutoCorrect for v2

09 Apr 2024, 07:57

kashmirLZ wrote:
07 Apr 2024, 02:05
Yeah some shouldn't be there, like:
::it's final::its final
Yeah I had a bunch of it's ... --> its ... ones in previous versions of the AutoCorrct2 script. (Including that one.) I think most were introduced with this Wikipedia grammar list
viewtopic.php?f=6&t=118965&p=528053#p528053
I think I've gotten most of the problem ones out, but if you see others in the more recent versions, please let me know so I can remove them.

EDIT: Actually... This prompted me to have another look at the it's ... --> its ... items. The current ones are below. I just now got rid of the three that are marked. I put commented examples of how the autocorrect items might cause problems.

Code: Select all

x:B0X*:it's current::f("its current") ; Fixes 1 word
; Is it current? Yeah, it's current.
:B0X*:it's end::f("its end") ; Fixes 1 word
:B0X*:it's entire::f("its entire") ; Fixes 1 word
x:B0X*:it's former::f("its former") ; Fixes 1 word
; Who cares?  It's former employees that are concerned. 
:B0X*:it's goal::f("its goal") ; Fixes 1 word
:B0X*:it's name::f("its name") ; Fixes 1 word
:B0X*:it's own::f("its own") ; Fixes 1 word
:B0X*:it's performance::f("its performance") ; Fixes 1 word
x:B0X*:it's source::f("its source") ; Fixes 1 word
; What kindo of code is this?  It's source code. 
:B0X*:it's successor::f("its successor") ; Fixes 1 word
:B0X*:it's tail::f("its tail") ; Fixes 1 word
:B0X*:it's theme::f("its theme") ; Fixes 1 word
:B0X*:it's timeslot::f("its timeslot") ; Fixes 1 word
:B0X*:it's toll::f("its toll") ; Fixes 1 word
:B0X*:it's website::f("its website") ; Fixes 1 word
I guess there are other conceivable ones, such as "What matters most? It's performance that matters most." IDK...
ste(phen|ve) kunkel
willwade
Posts: 9
Joined: 21 Feb 2017, 08:52
Contact:

Re: AutoCorrect for v2

10 Apr 2024, 11:28

FYI - in the making of this little tool https://abbreviation-finder.streamlit.app - I discovered espanso. It's neat. Its cross platform (win, Linux, Mac) and Free and Opensource. Some of the packages look similar to this AutoCorrect tool e.g https://hub.espanso.org/typofixer-en https://hub.espanso.org/contractions-en https://hub.espanso.org/misspell-en-uk and this is a neat idea https://hub.espanso.org/autocomplete-en
User avatar
kunkel321
Posts: 1062
Joined: 30 Nov 2015, 21:19

Re: AutoCorrect for v2

10 Apr 2024, 15:56

willwade wrote:
10 Apr 2024, 11:28
FYI - in the making of this little tool https://abbreviation-finder.streamlit.app - I discovered espanso. It's neat. Its cross platform (win, Linux, Mac) and Free and Opensource. Some of the packages look similar to this AutoCorrect tool e.g https://hub.espanso.org/typofixer-en https://hub.espanso.org/contractions-en https://hub.espanso.org/misspell-en-uk and this is a neat idea https://hub.espanso.org/autocomplete-en
Did you make the abbrev. finder site? That's pretty cool.
Espanso seems interesting. I'm a bit leery that there's a .bat file, but no uninstaller... Does this thing install stuff all over your system?
ste(phen|ve) kunkel
willwade
Posts: 9
Joined: 21 Feb 2017, 08:52
Contact:

Re: AutoCorrect for v2

11 Apr 2024, 02:03

kunkel321 wrote:
10 Apr 2024, 15:56
willwade wrote:
10 Apr 2024, 11:28
FYI - in the making of this little tool https://abbreviation-finder.streamlit.app - I discovered espanso. It's neat. Its cross platform (win, Linux, Mac) and Free and Opensource. Some of the packages look similar to this AutoCorrect tool e.g https://hub.espanso.org/typofixer-en https://hub.espanso.org/contractions-en https://hub.espanso.org/misspell-en-uk and this is a neat idea https://hub.espanso.org/autocomplete-en
Did you make the abbrev. finder site? That's pretty cool.
Espanso seems interesting. I'm a bit leery that there's a .bat file, but no uninstaller... Does this thing install stuff all over your system?
yes thats me :)

espanso - just use the standalone version for windows to try it out. It's pretty minimal. I'm not finding too many files everywhere, personally.
Jasonosaj
Posts: 51
Joined: 02 Feb 2022, 15:02
Location: California

Re: AutoCorrect for v2

11 Apr 2024, 10:06

    willwade wrote:
    11 Apr 2024, 02:03
    kunkel321 wrote:
    10 Apr 2024, 15:56
    willwade wrote:
    10 Apr 2024, 11:28
    FYI - in the making of this little tool https://abbreviation-finder.streamlit.app - I discovered espanso. It's neat. Its cross platform (win, Linux, Mac) and Free and Opensource. Some of the packages look similar to this AutoCorrect tool e.g https://hub.espanso.org/typofixer-en https://hub.espanso.org/contractions-en https://hub.espanso.org/misspell-en-uk and this is a neat idea https://hub.espanso.org/autocomplete-en
    Did you make the abbrev. finder site? That's pretty cool.
    Espanso seems interesting. I'm a bit leery that there's a .bat file, but no uninstaller... Does this thing install stuff all over your system?
    yes thats me :)

    espanso - just use the standalone version for windows to try it out. It's pretty minimal. I'm not finding too many files everywhere, personally.
    @willwade - you seem like you're doing great work and I'm super excited to see if you're able to make the SLM work in this context. I'd love to try the abbreviation finder but am dealing with documents that include PII and may be privileged. Is it possible to run locally?
    @kunkel321 - I have been going through the process of converting my _HS() hotstrings to call your f() function. One of the major problems is sorting. Do you have any recommendations in terms of how to order the various option sets to avoid nullification (e.g., beginnings, middles, ends / :*:, :*?:, :?:)?
    User avatar
    kunkel321
    Posts: 1062
    Joined: 30 Nov 2015, 21:19

    Re: AutoCorrect for v2

    11 Apr 2024, 18:25

    Jasonosaj wrote:
    11 Apr 2024, 10:06
    @kunkel321 - I have been going through the process of converting my _HS() hotstrings to call your f() function. One of the major problems is sorting. Do you have any recommendations in terms of how to order the various option sets to avoid nullification (e.g., beginnings, middles, ends / :*:, :*?:, :?:)?
    The process of converting shouldn't be too difficult... The _HS() system uses a second parameter for certain situations, whereas the f() system does not. I supposed that probably has to be changed by hand. But otherwise, I think you could find-and-replace :B0X with : (edit: No, not that... see bottom) and _HS(" with f(" Unless I'm mistaken(?)

    As far as the sorting and conflicting trigger strings, I'm thinking that will be the same, no matter which you use, or even if you just use vanilla default formatting (such as :?:toin::tion)

    Strictly speaking, using the terminology from the manual, when one item "nullifies" the other, the order doesn't matter. One will always make the other invisible. With the "conflicting" trigger strings though, order often does matter, and usually the longer (superset) trigger string needs to appear before/above the shorter (subset) one. If, by luck, they fall that way alphabetically, then it's all good. Otherwise (once you've identified them) you have to manually move them up higher in your code.

    I don't really have a good way to do that yet... Presently, I have a "===Do Not Sort===" group of about 50 autocorrect items that appear above the main list. I sort the sublist, but I do not sort/mix it with the rest of the 5k entries.

    As I type this, it occurs to me that the B0X options always appear before the other options (*/?/C). I suppose we could make it so the 'do not sort' items B0X, and the main list was XB0. That would allow sorting them all in one fell swoop. IDK.

    FYI, Here is that manual, if anyone is curious.
    EDIT: Manual has been updated. Today's manual is also in the GitHub repo.
    hh2 and AC Manual 4-16-2024.zip
    (1.11 MiB) Downloaded 9 times
    The relevant part is pages 14 and 15.

    Maybe try: Find-and-replace

    Code: Select all

    ::_HS ----> :temp:_HS
    :: ----> :B0X:
    :*: ----> :B0X*:
    :?: ----> :B0X?:
    :*?: ----> :B0X*?:
    then
    :temp:_HS ----> ::_HS
    Edit: Even better.... Get TED NotePad (which is free).
    find and replace like this:
    Image

    Extra comments: If anyone sees this information about changing from Deskolada's _HS() function for hotstrings, to the f() function, they should consider some important differences... The reason that I made the f() system, was so that I could log my autocorrects, then analyze them later, to see which ones got "backspaced" for being erroneous corrections. Because of this, my boilerplate hotstrings (such as ::;hand::have a nice day) never use the f() function. There's no need to analyze those, because they NEVER get entered by accident. For the same reason, a hotstring such as "::;mylogin::username{Tab}password" would never need to be sent via the f() function.

    Descolada's _HS() is more encompassing, and is made to accommodate all of these different scenarios. The only disadvantage is that the _HS() funciton doesn't log the hotstrings that are used.

    So...
    * If you are interested in logging and analyzing your autocorrects, use the f() system in this thread.
    * If you are not interested on logging, but want the ability to use more hotstring options (send modes, key delay, etc), then use the _HS() system
    here: viewtopic.php?f=83&t=122865

    For proper credit; I will again point out that the f() function uses Descolada's InputBuffer Class. If it weren't for the InputBuffer Class, the f() function wouldn't really be usable. Descolada has also recently created a Class that mimics AHK's native hotstring "case conformation" abilities. I probably won't integrate that into my own version of AutoCorrect, because I never really type in all caps.

    Last note: I still plan to make a version "HotString Helper 2.0" that is compatible with the _HS() format. It's on the back burner right now, but I can make it a priority if anyone is waiting for it...
    Last edited by kunkel321 on 16 Apr 2024, 21:06, edited 2 times in total.
    ste(phen|ve) kunkel
    Jasonosaj
    Posts: 51
    Joined: 02 Feb 2022, 15:02
    Location: California

    Re: AutoCorrect for v2

    12 Apr 2024, 11:12

    kunkel321 wrote:
    11 Apr 2024, 18:25
    Jasonosaj wrote:
    11 Apr 2024, 10:06
    @kunkel321 - I have been going through the process of converting my _HS() hotstrings to call your f() function. One of the major problems is sorting. Do you have any recommendations in terms of how to order the various option sets to avoid nullification (e.g., beginnings, middles, ends / :*:, :*?:, :?:)?
    The process of converting shouldn't be too difficult... The _HS() system uses a second parameter for certain situations, whereas the f() system does not. I supposed that probably has to be changed by hand. But otherwise, I think you could find-and-replace :B0X with : (edit: No, not that... see bottom) and _HS(" with f(" Unless I'm mistaken(?)

    As far as the sorting and conflicting trigger strings, I'm thinking that will be the same, no matter which you use, or even if you just use vanilla default formatting (such as :?:toin::tion)

    Strictly speaking, using the terminology from the manual, when one item "nullifies" the other, the order doesn't matter. One will always make the other invisible. With the "conflicting" trigger strings though, order often does matter, and usually the longer (superset) trigger string needs to appear before/above the shorter (subset) one. If, by luck, they fall that way alphabetically, then it's all good. Otherwise (once you've identified them) you have to manually move them up higher in your code.

    I don't really have a good way to do that yet... Presently, I have a "===Do Not Sort===" group of about 50 autocorrect items that appear above the main list. I sort the sublist, but I do not sort/mix it with the rest of the 5k entries.

    As I type this, it occurs to me that the B0X options always appear before the other options (*/?/C). I suppose we could make it so the 'do not sort' items B0X, and the main list was XB0. That would allow sorting them all in one fell swoop. IDK.

    FYI, Here is that manual, if anyone is curious.
    hh2 and AC Manual 2-15-2024.zip
    The relevant part is pages 14 and 15.

    Maybe try: Find-and-replace

    Code: Select all

    ::_HS ----> :temp:_HS
    :: ----> :B0X:
    :*: ----> :B0X*:
    :?: ----> :B0X?:
    :*?: ----> :B0X*?:
    then
    :temp:_HS ----> ::_HS
    Edit: Even better.... Get TED NotePad (which is free).
    find and replace like this:
    Image

    Extra comments: If anyone sees this information about changing from Deskolada's _HS() function for hotstrings, to the f() function, they should consider some important differences... The reason that I made the f() system, was so that I could log my autocorrects, then analyze them later, to see which ones got "backspaced" for being erroneous corrections. Because of this, my boilerplate hotstrings (such as ::;hand::have a nice day) never use the f() function. There's no need to analyze those, because they NEVER get entered by accident. For the same reason, a hotstring such as "::;mylogin::username{Tab}password" would never need to be sent via the f() function.

    Descolada's _HS() is more encompassing, and is made to accommodate all of these different scenarios. The only disadvantage is that the _HS() funciton doesn't log the hotstrings that are used.

    So...
    :x * If you are interested in logging and analyzing your autocorrects, use the f() system in this thread.
    * If you are not interested on logging, but want the ability to use more hotstring options (send modes, key delay, etc), then use the _HS() system
    here: viewtopic.php?f=83&t=122865

    For proper credit; I will again point out that the f() function uses Descolada's InputBuffer Class. If it weren't for the InputBuffer Class, the f() function wouldn't really be usable. Descolada has also recently created a Class that mimics AHK's native hotstring "case conformation" abilities. I probably won't integrate that into my own version of AutoCorrect, because I never really type in all caps.

    Last note: I still plan to make a version "HotString Helper 2.0" that is compatible with the _HS() format. It's on the back burner right now, but I can make it a priority if anyone is waiting for it...
    You can drop your logging function into _HS, rename it f(), and you should be good to go. I did it yesterday evening and everything seems to be doing great. I have been experiencing some issues with an incorrect number of backspaces being sent (particularly with very short hotstrings, e.g., :B0XC:i::f("I")) though.
    User avatar
    kunkel321
    Posts: 1062
    Joined: 30 Nov 2015, 21:19

    Re: AutoCorrect for v2

    12 Apr 2024, 12:21

    Jasonosaj wrote:
    12 Apr 2024, 11:12
    You can drop your logging function into _HS, rename it f(), and you should be good to go. I did it yesterday evening and everything seems to be doing great. I have been experiencing some issues with an incorrect number of backspaces being sent (particularly with very short hotstrings, e.g., :B0XC:i::f("I")) though.
    I thought about doing that! So far I haven't done it because, for my limited use of the function (only for autocorrection hotstrings), it has a bunch of features that would never be used. ...Also because I can barely understand how it works--LOL.

    Regarding the number of backspaces, I'm not sure, but I think the _HS() function supports turning the feature off via the second parameter in _HS(,).

    Also, As I think more about how I use B0 and X in the options, but Descolada doesn't, I guess you could go either way... The _HS() also requires those hotstring options, but Descolada's script sets them globally, with

    Code: Select all

    #Hotstring ZXB0
    Above the _HS() function calls.
    Then, to NOT use the function, you turn them off, per hotstring, with X0 and B. It's sortof relative which way you want to do it.
    ste(phen|ve) kunkel
    User avatar
    kunkel321
    Posts: 1062
    Joined: 30 Nov 2015, 21:19

    Re: AutoCorrect for v2

    13 Apr 2024, 15:08

    Okay... I think I've managed to correctly make a GitHub repository for this project. I'm still new to GitHub, so bearwith me as I continue learning to use it correctly.
    https://github.com/kunkel321/AutoCorrect2
    Last edited by kunkel321 on 17 Apr 2024, 12:07, edited 1 time in total.
    ste(phen|ve) kunkel
    d_romeo
    Posts: 27
    Joined: 23 Dec 2020, 12:18

    Re: AutoCorrect for v2

    14 Apr 2024, 12:41

    Is it possible to add words to an exclusion list to prevent them from being corrected? The script unfortunately interferes with other languages, for example: B0X*:beut:: f("beaut") interferes with "beuta" in Italian.
    User avatar
    kunkel321
    Posts: 1062
    Joined: 30 Nov 2015, 21:19

    Re: AutoCorrect for v2

    15 Apr 2024, 07:43

    @d_romeo There's not really an "ignore list" though the section near the top of the autocorrect items that looks like this:

    Code: Select all

    ; ===== Trigger strings to nullify the potential misspellings that are indicated. ======
    ; Used the word "corrects" in place of fix to avoid double-counting these as potential fixes. 
    :B0:Savitr:: ; (Important Hindu god) Here for :?:itr::it, which corrects 366 words.
    :B0:Vaisyas:: ; (A member of the mercantile and professional Hindu caste.) Here for :?:syas::says, which corrects 12 words.
    :B0:Wheatley:: ; (a fictional artificial intelligence from the Portal franchise) Here for :?:atley::ately, which corrects 162 words.
    works much the same way. This mostly just works with word-ending multi-match items though...

    The item :B0X*:beut::f("beaut") is a word beginning though, so that won't work.

    There's another way... Since the Italian word is so close (only one extra letter) I used hh2 to examine the :*:beaut:: item. It mostly corresponds to English words that start with "beautI." A few others correspond to "beaute" words or "beauty." Importantly, none of the corresponding triggers are found to misspell other words. (Hopefully none of them correspond to other Itilian words (?) So the way to go is, get rid of :B0X*:beut::f("beaut") and add:

    Code: Select all

    :B0X*:beute::f("beaute") ; Fixes 6 words 
    :B0X*:beuti::f("beauti") ; Fixes 19 words 
    :B0X*:beuty::f("beauty") ; Fixes 3 words
    ste(phen|ve) kunkel
    User avatar
    kunkel321
    Posts: 1062
    Joined: 30 Nov 2015, 21:19

    Re: AutoCorrect for v2

    15 Apr 2024, 07:53

    Incidentally... Typing the above reply made me realize that my "no sort" block of items near the top of the ac entries (but below the 'nullification' items) includes several word beginnings and middles. If word beginnings or middles can't be nullification items... How can those items coexist with their conflicting counterparts?? I'll double check that.

    Edit: There are at least a couple... For example the first item in my "no sort" section is:

    Code: Select all

    :B0X*:eyte::f("eye") ; Fixes 109 words
    This can never be triggered though, because the item:

    Code: Select all

    :B0X*:eyt::f("yet") ; Fixes 1 word
    will always trigger the instant you type the t. It doesn't matter what the location of the items are.

    No worries... This won't cause accidental misspellings... It just means the "potential fixes" reported by pressing F3 is over-estimating reporting (since at least 109 of those potential fixes would never happen.
    Last edited by kunkel321 on 15 Apr 2024, 12:33, edited 5 times in total.
    ste(phen|ve) kunkel
    d_romeo
    Posts: 27
    Joined: 23 Dec 2020, 12:18

    Re: AutoCorrect for v2

    15 Apr 2024, 08:55

    Is the word-by-word correction list available as an alternative, like in the old version v1?
    User avatar
    kunkel321
    Posts: 1062
    Joined: 30 Nov 2015, 21:19

    Re: AutoCorrect for v2

    15 Apr 2024, 09:26

    d_romeo wrote:
    15 Apr 2024, 08:55
    Is the word-by-word correction list available as an alternative, like in the old version v1?
    Not sure what you mean... If you mean the list of 'whole-word' autocorrect items from the original 2007 AutoCorrrect.ahk, check the very first post in this thread.
    ste(phen|ve) kunkel

    Return to “Scripts and Functions (v2)”

    Who is online

    Users browsing this forum: Google [Bot] and 41 guests