hugo321 Posted August 28, 2008 Share Posted August 28, 2008 so, i want to make a program in which i input letters. 5-7 letters or so, and i want my program to make all possible combinations of the letters, is this possible with autoit? then i want it to filter out words which i have in a text document list. would this be the best way to go around this? i have a list of words. > i input letters > program makes all possible words made from the letters. would this be a complex task to do? i kinda need some pointers here Link to comment Share on other sites More sharing options...
Zedna Posted August 28, 2008 Share Posted August 28, 2008 This is simple. Don't hesitate and start with project. When you will have some progress post TXT/code and somebody will help you in case of troubles ... Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
weaponx Posted August 28, 2008 Share Posted August 28, 2008 (edited) Are partial word matches allowed? Sounds like a Scrabble word generator. Edited August 28, 2008 by weaponx Link to comment Share on other sites More sharing options...
hugo321 Posted August 29, 2008 Author Share Posted August 29, 2008 Are partial word matches allowed? Sounds like a Scrabble word generator. yea... im going to cheat in scrabble... no really, it is a challenge, and i really have no clue in where to start in the generation part, cause making a program make ALL combinations of a few letters or numbers is kindof hard for me to understand.i could make alot with the random line, but that would make dublicates and a non logic list. if it was numbers i would like them to be 1,2,3,4,5 and letters alike. Link to comment Share on other sites More sharing options...
weaponx Posted August 29, 2008 Share Posted August 29, 2008 Now i'm more confused. From your first post this is what I got. You have a list of valid dictionary words. You want to input some letters and retrieve every word from your "dictionary" containing these letters. How do numbers fit into that? Link to comment Share on other sites More sharing options...
wakummaci Posted August 29, 2008 Share Posted August 29, 2008 I think he just said an example of what he wants. Link to comment Share on other sites More sharing options...
weaponx Posted August 29, 2008 Share Posted August 29, 2008 This will search every word in an array and output *only* words containing ALL of the given letters. I had no luck with the regular expression method since their is no AND operator in regex.;Characters used to find matching words (order doesn't matter) $string = "cp" Dim $array[9] $array[0] = "apple" $array[1] = "appliance" $array[2] = "application" $array[3] = "beast" $array[4] = "berry" $array[5] = "boat" $array[6] = "cantaloupe" $array[7] = "cargo" $array[8] = "collision" For $X = 0 to Ubound($array) -1 ;METHOD 1 - Regular Expression ;$result = StringRegExp($array[$X],".*[c].*\A.*[s].*",0) ;METHOD 2 - Loop through every character $result = 1 $chars = StringSplit($string,"") For $Y = 1 to $chars[0] If NOT StringInStr($array[$X], $chars[$Y]) Then ContinueLoop 2 EndIf Next ;Output matched word If $result Then ConsoleWrite($array[$X] & @CRLF) Next Link to comment Share on other sites More sharing options...
martin Posted August 29, 2008 Share Posted August 29, 2008 (edited) This will search every word in an array and output *only* words containing ALL of the given letters. I had no luck with the regular expression method since their is no AND operator in regex. ;Characters used to find matching words (order doesn't matter) $string = "cp" Dim $array[9] $array[0] = "apple" $array[1] = "appliance" $array[2] = "application" $array[3] = "beast" $array[4] = "berry" $array[5] = "boat" $array[6] = "cantaloupe" $array[7] = "cargo" $array[8] = "collision" For $X = 0 to Ubound($array) -1 ;METHOD 1 - Regular Expression ;$result = StringRegExp($array[$X],".*[c].*\A.*[s].*",0) ;METHOD 2 - Loop through every character $result = 1 $chars = StringSplit($string,"") For $Y = 1 to $chars[0] If NOT StringInStr($array[$X], $chars[$Y]) Then ContinueLoop 2 EndIf Next ;Output matched word If $result Then ConsoleWrite($array[$X] & @CRLF) Next That finds all the words which contain at least one of each of the different letters in $string. It won't find words which only consist of all the letters in $string. If that is what is wanted here is one way to do it #include <Array.au3> ;Characters used to find matching words (order doesn't matter) $string = "lpeap" Dim $array[9] $array[0] = "apple" $array[1] = "appliance" $array[2] = "application" $array[3] = "beast" $array[4] = "berry" $array[5] = "boat" $array[6] = "cantaloupe" $array[7] = "cargo" $array[8] = "collision" $sort1 = Ordered($string);Put $string into alphabetical order. For $X = 0 To UBound($array) - 1 ;find only words which have exactly the same letters as in $string If $sort1 = Ordered($array[$X]) Then ConsoleWrite($array[$X] & @CRLF) Next ;func to return the string arranged alphabetically Func Ordered($ss) Local $res, $n Local $aS = StringSplit($ss, "") _ArraySort($aS) For $n = 1 To UBound($aS) - 1 $res &= $aS[$n] Next Return $res EndFunc ;==>Ordered Edited August 29, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
weaponx Posted August 30, 2008 Share Posted August 30, 2008 That finds all the words which contain at least one of each of the different letters in $string. It won't find words which only consist of all the letters in $string. If that is what is wanted here is one way to do itYou are incorrect. Continueloop is called if even one letter isn't matched in a word, moving to the next word in the dictionary. Link to comment Share on other sites More sharing options...
martin Posted August 30, 2008 Share Posted August 30, 2008 You are incorrect. Continueloop is called if even one letter isn't matched in a word, moving to the next word in the dictionary.I didn't mean that weaponex. I meant that your script checks if the letters in $string are in the string in each array. But if $string has the letter B twice and the string in the array has only 1 it will say it matched, and if the string in the array has letters which are not in $string it will also say it matched. So my script was to match only those words in the array which had exactly the same letters as in string, or another words, my script only matches anagrams. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
James Posted August 30, 2008 Share Posted August 30, 2008 You need to really make this read from a file, I am sure there are dictionary files out there somewhere. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now