Re: Puzzle Challenge
- To: mathgroup at smc.vnet.net
- Subject: [mg63606] Re: Puzzle Challenge
- From: Paul <gleam at flashmail.com>
- Date: Sat, 7 Jan 2006 02:29:29 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Paul Abbott wrote: > Mathematica has a built-in dictionary which can be > called using > > NotebookGetMisspellingsPacket > > This was used in The Mathematica Journal 9(1): 36-37 > (2003) to produce > all anagrams of a given string. The essential code > used is > > GetMisspelledWords[text_, language_:"English"] := > = Module[{nb, result}, > nb = NotebookPut[Notebook[{Cell[text, "Text", > LanguageCategory -> NaturalLanguage, > DefaultNaturalLanguage -> language]}, Visible -> > le -> False]]; > LinkWrite[$ParentLink, > nk, NotebookGetMisspellingsPacket[nb]]; > result = LinkRead[$ParentLink]; > NotebookClose[nb, Interactive -> False]; > result] > > CorrectWords[wl_List, language_:"English"] := > > Complement[wl,GetMisspelledWords[ToString[Infix[wl," > " "]], language]]; > > For example, try > > CorrectWords[{"the","teh"}] > > It would be straightforward to use this code to solve > your puzzle -- but > I'll leave this to others with more time on their > hands. > > Cheers, > Paul Paul, Thank you for taking the time to reply. That is a very clever use of the integrated spell checker. I am sorry that you will not be posting a solution in which it is used. I cannot know how much time this would take, but I can say that an effective, albeit inefficient, function can be written in fewer characters than the combined length of your two functions above. I did not perceive this puzzle as particularly challenging, yet considerable effort could be spent finding an especially good or novel solution. It was my hope that this would allow interest from a variety of people. It appears I was mistaken. Paul