Alright.
I've finished my anagram solver and it solves all permutations of 4 letter words up to 15 letter words for an infinitely long word used as your input.
I cracked the code to do it all perfectly and without error and is detailed herehttps://autohotkey.com/boards/viewtopic ... 19&t=34285 along with the script!
Alternatives to RegExMatch?
- littlegandhi1199
- Posts: 195
- Joined: 29 Aug 2016, 23:58
Alternatives to RegExMatch?
Last edited by littlegandhi1199 on 10 Jul 2017, 15:57, edited 1 time in total.
Script Backups on every Execution
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=75767&p=328155#p328155
Scrabble Solver 4-15 letter word outputs ( # of inputs)
https://www.autohotkey.com/boards/viewtopic.php?f=19&t=34285
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=75767&p=328155#p328155
Scrabble Solver 4-15 letter word outputs ( # of inputs)
https://www.autohotkey.com/boards/viewtopic.php?f=19&t=34285
Re: Alternatives to RegExMatch?
why you are testing !!!
- littlegandhi1199
- Posts: 195
- Joined: 29 Aug 2016, 23:58
Re: Alternatives to RegExMatch?
hello again, I made a program that generates permutations of a word (anagram maker) and it compares it against a 5mb dictionary file for any real words.YoucefHam wrote:why you are testing !!!
Does it for 4 letter words, 5 letter words, and up to 11 letter words which when you look at the total permutations it has to do for an 11 letter anagram...
that's 39 million possibilites my friend
even 1ms slower per comparison and my program will take 10 hours longer to complete
Script Backups on every Execution
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=75767&p=328155#p328155
Scrabble Solver 4-15 letter word outputs ( # of inputs)
https://www.autohotkey.com/boards/viewtopic.php?f=19&t=34285
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=75767&p=328155#p328155
Scrabble Solver 4-15 letter word outputs ( # of inputs)
https://www.autohotkey.com/boards/viewtopic.php?f=19&t=34285
Re: Alternatives to RegExMatch?
I suggest you (sort the dictionary and) do a binary search.
- littlegandhi1199
- Posts: 195
- Joined: 29 Aug 2016, 23:58
Re: Alternatives to RegExMatch?
Great idea!
Now, how would you search a file differently using binary though?
Now, how would you search a file differently using binary though?
Script Backups on every Execution
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=75767&p=328155#p328155
Scrabble Solver 4-15 letter word outputs ( # of inputs)
https://www.autohotkey.com/boards/viewtopic.php?f=19&t=34285
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=75767&p=328155#p328155
Scrabble Solver 4-15 letter word outputs ( # of inputs)
https://www.autohotkey.com/boards/viewtopic.php?f=19&t=34285
Re: Alternatives to RegExMatch?
It is very easy to implement a binary search, google it. If you are lazy (it's ok), you can use do something like this, I assume guess ahk uses binary search for key look ups,
So you look up by doing dict.Haskey(...), answer is true or false.
Code: Select all
setbatchlines,-1
listlines,off
#noenv
dictionary= ; Use fileread
(
Bruce
Arnold
Dolph
Chuck
)
Sort, dictionary ; Sort the dictionary if it is not already sorted (not really needed)
strreplace(dictionary, "`n","`n",n) ; Count the lines (not really needed)
dict:=[]
dict.setcapacity(n) ; Allocate space for n keys. Might improve performance if the dictionary is very big. (not really needed)
Loop, Parse, dictionary, `n
dict[A_LoopField]:=A_Index ; Use each word in the dictionary as a key in the dict array
msgbox, % dict.haskey("bruce") ? "Yes on row: " dict["bruce"] : "No" ; this is not case sensitive but I assume it is ok in your case.
dictionary:=""
for k in dict
str.= k "`n"
msgbox, % str
- littlegandhi1199
- Posts: 195
- Joined: 29 Aug 2016, 23:58
Re: Alternatives to RegExMatch?
Helgef wrote:It is very easy to implement a binary search, google it. If you are lazy (it's ok), you can use do something like this, Iassumeguess ahk uses binary search for key look ups,So you look up by doing dict.Haskey(...), answer is true or false.Code: Select all
setbatchlines,-1 listlines,off #noenv dictionary= ; Use fileread ( Bruce Arnold Dolph Chuck ) Sort, dictionary ; Sort the dictionary if it is not already sorted (not really needed) strreplace(dictionary, "`n","`n",n) ; Count the lines (not really needed) dict:=[] dict.setcapacity(n) ; Allocate space for n keys. Might improve performance if the dictionary is very big. (not really needed) Loop, Parse, dictionary, `n dict[A_LoopField]:=A_Index ; Use each word in the dictionary as a key in the dict array msgbox, % dict.haskey("bruce") ? "Yes on row: " dict["bruce"] : "No" ; this is not case sensitive but I assume it is ok in your case. dictionary:="" for k in dict str.= k "`n" msgbox, % str
Brilliant idea, and your example works but once I put the same thing in txt.txt it fails
brucee
Arnold
Dolph
Chuck
bruce = brucee
FileRead, dictionary, txt.txt
dict =
dict:=[]
Loop, Parse, dictionary, `n
dict[A_LoopField]:=A_Index
if (dict.haskey(bruce) > 0)
msgbox, found "%bruce%" in`n"%dictionary%"
else
msgbox, "%bruce%" is missing from`n"%dictionary%"
dictionary=
(
brucee
Arnold
Dolph
Chuck
)
dict =
dict:=[]
Loop, Parse, dictionary, `n
dict[A_LoopField]:=A_Index
if (dict.haskey(bruce) > 0)
msgbox, found "%bruce%" in`n"%dictionary%"
else
msgbox, "%bruce%" is missing from`n"%dictionary%"
Script Backups on every Execution
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=75767&p=328155#p328155
Scrabble Solver 4-15 letter word outputs ( # of inputs)
https://www.autohotkey.com/boards/viewtopic.php?f=19&t=34285
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=75767&p=328155#p328155
Scrabble Solver 4-15 letter word outputs ( # of inputs)
https://www.autohotkey.com/boards/viewtopic.php?f=19&t=34285
Re: Alternatives to RegExMatch?
Hello, There might an issue with the line breaks. Try to to replace the Loop, ... line with Loop, Parse, dictionary, `n, `r
- littlegandhi1199
- Posts: 195
- Joined: 29 Aug 2016, 23:58
Re: Alternatives to RegExMatch?
My own anagram solver that is buggy is already uploaded somewhere.
Once I fix it I will add to your guys' too
Once I fix it I will add to your guys' too
Script Backups on every Execution
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=75767&p=328155#p328155
Scrabble Solver 4-15 letter word outputs ( # of inputs)
https://www.autohotkey.com/boards/viewtopic.php?f=19&t=34285
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=75767&p=328155#p328155
Scrabble Solver 4-15 letter word outputs ( # of inputs)
https://www.autohotkey.com/boards/viewtopic.php?f=19&t=34285
Who is online
Users browsing this forum: Theda and 142 guests