Hi Puzzlers! Let's take a shot at this week's Sunday Puzzle from NPR.
This week's challenge comes from listener Greg VanMechelen, of Berkeley, Calif. Think of a popular food item in six letters. Change the last two letters to a K to make a common five-letter word in which none of the letters are pronounced the same as in the six-letter food. What food is this?
Ah, a classic transformation puzzle-- take a thing from Class A, apply the given transformation, return a thing from Class B. We've done this a million times! Let's break it down.
We need:
- A list of food words:
- Foods are a common puzzle theme, so we can simply reuse the food lexicon we created for previous puzzles, here.
- We'll filter this list down to 6-letter words.
- An English lexicon:
- After we apply the transformation, we'll need to check if the resulting string is a real word.
- Here's a lexicon of 10k words we've scraped and cobbled together for previous puzzles.
- A script with the following functions:
- load lexicons from text files (i.e., food lexicon & general English lexicon);
- filter the lexicons to 6-letters and 5-letters respectively;
- iterate through the food lexicon and:
- transform spelling (replace last two letters of food word with "k");
- check English lexicon for transformed string;
- print original string and new string (if new string is in English lexicon);
But wait--what about the pronunciation bit? We certainly could do this easily enough using a pronunciation dictionary, as we did with the CMU pronunciation dictionary for this puzzle, for example. However, I think it would be overkill. I'm confident that the number of candidate pairs where we have a food word that is transformed into a real English word is going to be so small that we can easily pick the correct solution from the results. In fact, there may only be one candidate pair--we'll find out soon!
I've whipped up a script as described above; feel free to try to get it working. I'll be back after the Thursday NPR deadline to share my results. Good luck!
No comments:
Post a Comment