im doing research project for a the game Text twist,the text will automatically search word from a dictionary and scramble then, and also process the words to be found automatically using the same concept with this site http://grecni.com/texttwist.php , i also need to provide an algorithm that i will use for my project,and im planning to include this word unscrambler in this web site http://grecni.com/texttwist.php but i dont know what algorithm is possibly use to do the actions done on the website i posted. does any one know what type, or what you call the algorithm used,or can be use that will give the same results, an example of the algorithm will be greatly appreciated.
im doing research project for a the game Text twist,the text will automatically search
Share
The data structure you want is called a Directed Acyclic Word Graph (dawg)
There are questions already answered about this:
Algorithm to get a list of all words that are anagrams of all substrings (scrabble)?
Writing an algorithm for scrabble
You could also perhaps implement the levenshtein algorithm which would accomplish pretty much the same result:
MySQL – Which Hash Algo should I use for this?
Update:
After giving myself a challenge to create an example to demonstrate the algorithm ive come up with this, as its from a plugin built for my cms its wrapped in a class but your get the idea there is a demo @ http://cherone.co.uk/scrabble_suggest
First I created a table with id,word,sorted (word = the actual word, sorted = the word alphabetically sorted like for e.g: aardvark sorted would be aaadkrrv) i just found an english wordlist on the internets.
The form posts the string and then the string is sorted alphabetically to match 1:1 the sorted column, then the string is split into each character and then queried sequentially till the last character. The functions of interest are
str_sort,permute,swapPerhaps its of some interest..