Given a word jumble (i.e. ofbaor), what would be an approach to unscramble the letters to create a real word (i.e. foobar)? I could see this having a couple of approaches, and I think I know how I'd do it in .NET, but I curious to see what some other solutions look like (always happy to see if my solution is optimal or not).
This isn't homework or anything like that, I just saw a word jumble in the local comics section of the paper (yes, good ol' fashioned newsprint), and the engineer in me started thinking.
edit: please post some pseudo code or real code if you can; it's always nice to try and expand language knowledge by seeing examples like this.
Tip 1: Look for prefixes or suffixes such as “RE” or “ING”. These can help you extend other words. Tip 2: Try to find letters that often go together in words like “BR” or “TH”. Tip 3: Move the vowels and consonants apart.
This is a two players game, firstly program pick a random word from the given list of words using choice() method of random module. After shuffling the characters of picked word using sample method of random module and shows the jumbled word on the screen.
Jumble was created in 1954 by Martin Naydel, who is better known for his work on comic books. Daily and Sunday Jumble puzzles appear in over 600 newspapers in the United States and internationally. As of 2014, Jumble is created by David L. Hoyt and Jeff Knurek.
Have a dictionary that's keyed by the letters of each word in sorted order. Then take you jumble an sort the letters - look up all the words in the dictionary by that sorted-letter string.
So, as an example, the words 'bear' and 'bare' would be in the dictionary as follows:
key word
----- ------
aber bear
aber bare
And if you're given the jumble, 'earb', you'd sort the letters to 'aber' and be able to look up both possible words in the dictionary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With