[xsl] Fun w/ Anagrams and FXSL: Anagram Baby Names! :D (And A Mystery To Help Solve)

Subject: [xsl] Fun w/ Anagrams and FXSL: Anagram Baby Names! :D (And A Mystery To Help Solve)
From: "M. David Peterson" <m.david@xxxxxxxxxxxxx>
Date: Tue, 08 Jan 2008 16:19:31 -0700
Just because I have way too much to do and an uncanny *in*ability to stay focused on *anything* important, I decided to excercise my brain a bit and follow suit to Dare Obasanjo's C#/LINQ response[1] to Brad Fitzpatrick's Python and Perl-based baby name anagram code challenge[2]**. Of course what better way to excercise ones brain than to find someone who's smarter than you, take their prewritten code[3] that they slaved over for who knows how long to perfect, customize it, and call it your own? :D

That's exactly how I feel too ;-), and as such, here's my variation of Dimitre's anagram code base customized to output all potential anagram combinations of baby names (both girls and boys).

The code: http://xslt.googlecode.com/svn/trunk/Modules/Anagram/BabyNames/anagaram-baby-names.xsl
The female names: http://xslt.googlecode.com/svn/trunk/Modules/Anagram/BabyNames/dist.female.first
The males names: http://xslt.googlecode.com/svn/trunk/Modules/Anagram/BabyNames/dist.male.first
The result: http://xslt.googlecode.com/svn/trunk/Modules/Anagram/BabyNames/result

NOTE: To run this code you will either need to either check out the trunk of of the XSLT Google Code SVN repository[4], or if you already have FXSL on your machine, check out[5] and change the values of the xsl:import elements to point at the location of the FXSL libraries on your machine. Also, if you're on Windows and you check out the trunk of the repository, you may need to adjust the import values to ../../../Functions/fxsl-xslt2/f/<name_of_function_library>.xsl as I've symlink'd the "f" directory and I'm not sure how SVN handles symlinks on Windows during the checkout process. Anyone know if it resolves symlinks and copys the linked directory in place of the symlink?

Now comes the fun stuff,

If you scroll to the bottom of the result you'll see a good example of something that currently has me scratching my head,

Key: ORY Names: ROY  ROY

Question: Why are there some entries in which see the same visible name as being different?

Is it (potentially) because the given name exists in both lists and I need to for-each-group the entries before generating the dictionary (or after for that matter).

Something different?


Thanks in advance for helping me solve my current mystery!

[1] http://www.25hoursaday.com/weblog/2008/01/08/FindingNamesThatAreAnagramsOfEachOtherInC30.aspx
[2] http://brad.livejournal.com/2354680.html
[3] http://dnovatchev.spaces.live.com/blog/cns!44B0A32C2CCF7488!357.entry
[4] http://xslt.googlecode.com/svn/trunk/
[5] http://xslt.googlecode.com/svn/trunk/Modules/Anagram/BabyNames/
** Okay, so it wasn't really a code challenge per se, but if you write a blog entry with any given coding solution to any given problem, it might as well be a challenge 'cuz every language loving zealot on the planet is going to see it as just that. :D


M. David Peterson
Co-Founder & Chief Architect, 3rd&Urban, LLC
Email: m.david@xxxxxxxxxxxxxxx | m.david@xxxxxx
Mobile: (206) 418-9027
http://3rdandUrban.com | http://amp.fm | http://www.oreillynet.com/pub/au/2354

Current Thread