<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: An Anagram Detector</title>
	<atom:link href="http://shriphani.com/blog/2008/06/14/an-anagram-detector/feed/" rel="self" type="application/rss+xml" />
	<link>http://shriphani.com/blog/2008/06/14/an-anagram-detector/</link>
	<description>Weblog of an Aspiring Computer Scientist</description>
	<pubDate>Thu, 04 Dec 2008 21:46:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
		<item>
		<title>By: Shriphani&#8217;s Weblog - Huge Anagram List</title>
		<link>http://shriphani.com/blog/2008/06/14/an-anagram-detector/#comment-638</link>
		<dc:creator>Shriphani&#8217;s Weblog - Huge Anagram List</dc:creator>
		<pubDate>Thu, 21 Aug 2008 22:51:08 +0000</pubDate>
		<guid isPermaLink="false">http://shriphani.com/blog/?p=155#comment-638</guid>
		<description>[...] got on this blog) over to my account. Then, I ran a very huge file full of words through my anagram detector and the results were astonishing, a record 1.93 seconds to parse over 10000 words and pick [...]</description>
		<content:encoded><![CDATA[<p>[...] got on this blog) over to my account. Then, I ran a very huge file full of words through my anagram detector and the results were astonishing, a record 1.93 seconds to parse over 10000 words and pick [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maarten van Emden</title>
		<link>http://shriphani.com/blog/2008/06/14/an-anagram-detector/#comment-359</link>
		<dc:creator>Maarten van Emden</dc:creator>
		<pubDate>Sat, 12 Jul 2008 19:00:02 +0000</pubDate>
		<guid isPermaLink="false">http://shriphani.com/blog/?p=155#comment-359</guid>
		<description>I found your blog when searching for the source of the anagram program I vaguely remembered. So it was Bentley. Thanks. I also found  http://pramode.net/2005/11/18/teaching-tips-the-anagram-problem-solved-in-unix-style/
Programming it is fun, but it is also fun to do it without programming, which is what Bentley showed. Bentley tells how Tom Cargill (another  person worth knowing) describes the method: "first sort this way (moves hand from left to right), then sort that way (moves hand up and down).</description>
		<content:encoded><![CDATA[<p>I found your blog when searching for the source of the anagram program I vaguely remembered. So it was Bentley. Thanks. I also found  <a href="http://pramode.net/2005/11/18/teaching-tips-the-anagram-problem-solved-in-unix-style/" rel="nofollow">http://pramode.net/2005/11/18/teaching-tips-the-anagram-problem-solved-in-unix-style/</a><br />
Programming it is fun, but it is also fun to do it without programming, which is what Bentley showed. Bentley tells how Tom Cargill (another  person worth knowing) describes the method: &#8220;first sort this way (moves hand from left to right), then sort that way (moves hand up and down).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin</title>
		<link>http://shriphani.com/blog/2008/06/14/an-anagram-detector/#comment-288</link>
		<dc:creator>Justin</dc:creator>
		<pubDate>Tue, 24 Jun 2008 19:15:06 +0000</pubDate>
		<guid isPermaLink="false">http://shriphani.com/blog/?p=155#comment-288</guid>
		<description>def sign(word):
        #can't hash a list
        return tuple(sorted(word))

def anagramCollect(filename):
        f = open(filename, "r")
        ana_dict = {}
        for word in f:
                word = word.rstrip()
                signature = sign(word)
                ana_dict.setdefault(signature,[]).append(word)
        f.close()
        return ana_dict</description>
		<content:encoded><![CDATA[<p>def sign(word):<br />
        #can&#8217;t hash a list<br />
        return tuple(sorted(word))</p>
<p>def anagramCollect(filename):<br />
        f = open(filename, &#8220;r&#8221;)<br />
        ana_dict = {}<br />
        for word in f:<br />
                word = word.rstrip()<br />
                signature = sign(word)<br />
                ana_dict.setdefault(signature,[]).append(word)<br />
        f.close()<br />
        return ana_dict</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: J</title>
		<link>http://shriphani.com/blog/2008/06/14/an-anagram-detector/#comment-280</link>
		<dc:creator>J</dc:creator>
		<pubDate>Sun, 22 Jun 2008 02:38:41 +0000</pubDate>
		<guid isPermaLink="false">http://shriphani.com/blog/?p=155#comment-280</guid>
		<description>To be even lazy, we can do:

from itertools import groupby

def sign(xs):
   return "".join(x + str(len(list(g))) 
                      for x, g in groupby(sorted(xs)))</description>
		<content:encoded><![CDATA[<p>To be even lazy, we can do:</p>
<p>from itertools import groupby</p>
<p>def sign(xs):<br />
   return &#8220;&#8221;.join(x + str(len(list(g)))<br />
                      for x, g in groupby(sorted(xs)))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://shriphani.com/blog/2008/06/14/an-anagram-detector/#comment-271</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Mon, 16 Jun 2008 11:47:16 +0000</pubDate>
		<guid isPermaLink="false">http://shriphani.com/blog/?p=155#comment-271</guid>
		<description>@DiThi: good call. 

If you're using a recent Python, consider just doing: "".join(sorted(WORD)).</description>
		<content:encoded><![CDATA[<p>@DiThi: good call. </p>
<p>If you&#8217;re using a recent Python, consider just doing: &#8220;&#8221;.join(sorted(WORD)).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DiThi</title>
		<link>http://shriphani.com/blog/2008/06/14/an-anagram-detector/#comment-270</link>
		<dc:creator>DiThi</dc:creator>
		<pubDate>Mon, 16 Jun 2008 02:58:46 +0000</pubDate>
		<guid isPermaLink="false">http://shriphani.com/blog/?p=155#comment-270</guid>
		<description>Here's my signature maker:

def sign(word):
    x=list(word)
    x.sort()
    return ''.join(x)

It's a different format of signature but I'm sure it's faster.</description>
		<content:encoded><![CDATA[<p>Here&#8217;s my signature maker:</p>
<p>def sign(word):<br />
    x=list(word)<br />
    x.sort()<br />
    return &#8221;.join(x)</p>
<p>It&#8217;s a different format of signature but I&#8217;m sure it&#8217;s faster.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Pirnat</title>
		<link>http://shriphani.com/blog/2008/06/14/an-anagram-detector/#comment-266</link>
		<dc:creator>Mike Pirnat</dc:creator>
		<pubDate>Sat, 14 Jun 2008 12:46:41 +0000</pubDate>
		<guid isPermaLink="false">http://shriphani.com/blog/?p=155#comment-266</guid>
		<description>To get around the repeated slicing of the last character in your word, you could always do:


for word in f:
    word = word.strip()
    ...
</description>
		<content:encoded><![CDATA[<p>To get around the repeated slicing of the last character in your word, you could always do:</p>
<p>for word in f:<br />
    word = word.strip()<br />
    &#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
