pythonrubycpu-wordanagramboggle

Finding words from random input letters in python. What algorithm to use/code already there?


I am trying to code a word descrambler like this one here and was wondering what algorithms I should use to implement this. Also, if anyone can find existing code for this that would be great as well. Basically the functionality is going to be like a boggle solver but without being a matrix, just searching for all word possibilities from a string of characters. I do already have adequate dictionaries.

I was planning to do this in either python or ruby. Thanks in advance for your help guys!


Solution

  • I'd use a Trie. Here's an implementation in Python: http://jtauber.com/2005/02/trie.py (credit to James Tauber)