<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Algorithm Blogs &#187; Humour</title>
	<atom:link href="http://www.algorithm.co.il/blogs/index.php/category/humour/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.algorithm.co.il/blogs</link>
	<description>Algorithms, for the heck of it</description>
	<lastBuildDate>Thu, 22 Apr 2010 21:04:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>And now for something completely different</title>
		<link>http://www.algorithm.co.il/blogs/index.php/programming/python/and-now-for-something-completely-different/</link>
		<comments>http://www.algorithm.co.il/blogs/index.php/programming/python/and-now-for-something-completely-different/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 18:28:42 +0000</pubDate>
		<dc:creator>lorg</dc:creator>
				<category><![CDATA[Humour]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[clip]]></category>
		<category><![CDATA[humor]]></category>
		<category><![CDATA[python zen]]></category>

		<guid isPermaLink="false">http://www.algorithm.co.il/blogs/?p=484</guid>
		<description><![CDATA[My friend Yuval whom you might already know from the comments here, apparently composed music for the Python Zen. It made me laugh today, and as it&#8217;s been a long day, I thought it&#8217;s worth sharing here. Especially as it is Python related.

]]></description>
			<content:encoded><![CDATA[<p>My friend <a href="http://uberpython.wordpress.com/">Yuval</a> whom you might already know from the comments here, apparently composed music for the <a href="http://www.python.org/dev/peps/pep-0020/">Python Zen</a>. It made me laugh today, and as it&#8217;s been a long day, I thought it&#8217;s worth sharing here. Especially as it is Python related.</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/kYB72Qa6F9I&#038;hl=en&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/kYB72Qa6F9I&#038;hl=en&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.algorithm.co.il/blogs/index.php/programming/python/and-now-for-something-completely-different/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rhyme and Reason with Python</title>
		<link>http://www.algorithm.co.il/blogs/index.php/programming/python/rhyme-and-reason-with-python/</link>
		<comments>http://www.algorithm.co.il/blogs/index.php/programming/python/rhyme-and-reason-with-python/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 09:55:22 +0000</pubDate>
		<dc:creator>lorg</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Humour]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Algorithm]]></category>
		<category><![CDATA[Natural Language Processing]]></category>
		<category><![CDATA[NLTK]]></category>
		<category><![CDATA[rhymes]]></category>
		<category><![CDATA[xkcd]]></category>

		<guid isPermaLink="false">http://www.algorithm.co.il/blogs/index.php/programming/python/rhyme-and-reason-with-python/</guid>
		<description><![CDATA[After reading xkcd's blog, I went to LimerickDB.com. It looks and works just like bash.org, but for limericks. Quite amused with some of the limericks available, I wanted to try and compose my own.
The first one came out fine, but I got stuck without a rhyme for the second one:
a man named guido once thought
he'd [...]]]></description>
			<content:encoded><![CDATA[<p>After reading <a href="http://blag.xkcd.com/2008/02/04/limerickdbcom/">xkcd's blog</a>, I went to <a href="http://limerickdb.com/">LimerickDB.com</a>. It looks and works just like bash.org, but for limericks. Quite amused with some of the limericks available, I wanted to try and compose my own.<br />
The first one came out fine, but I got stuck without a rhyme for the second one:</p>
<blockquote><p>a man named guido once thought<br />
he'd invent a language well wrought<br />
indentation as tabs</p></blockquote>
<p>Uhm, no luck there... "tabs" does not rhyme well. Then an idea came... I could create a rhyme index!<br />
How to do it?<br />
First, I took my <a href="http://www.algorithm.co.il/blogs/index.php/programming/python/simple-word-lookup-for-crosswords-and-such/">already written</a> word index. Last time I used it was to solve a substitution cipher for my crypto homework.<br />
Then, I looked for the phonemes for each word, using <a href="http://espeak.sourceforge.net/">espeak</a> - a text to speech program:</p>
<pre>
lorg@kild:~$ espeak -q -x hello
 h@l'oU
</pre>
<p>After doing so, I collected words that had similar phonemes endings, and there it was, a rhyme index:</p>
<div class="syntax_hilite">
<div id="python-3">
<div class="python">In <span style="color: black;">&#91;</span><span style="color: #ff4500;">84</span><span style="color: black;">&#93;</span>: words.<span style="color: #000000;">get_word_rhymes</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">"tabs"</span>, word_index, rhyme_index<span style="color: black;">&#41;</span><span style="color: black;">&#91;</span>:<span style="color: #ff4500;">10</span><span style="color: black;">&#93;</span><br />
Out<span style="color: black;">&#91;</span><span style="color: #ff4500;">84</span><span style="color: black;">&#93;</span>: <br />
<span style="color: black;">&#91;</span><span style="color: #483d8b;">'crabs'</span>, <span style="color: #483d8b;">'stabs'</span>, <span style="color: #483d8b;">'macnabs'</span>,<br />
&nbsp;<span style="color: #483d8b;">'dabs'</span>, <span style="color: #483d8b;">'cabs'</span>, <span style="color: #483d8b;">'scabs'</span>,<br />
&nbsp;<span style="color: #483d8b;">'slabs'</span>, <span style="color: #483d8b;">'arabs'</span>, <span style="color: #483d8b;">'snobs'</span>,<br />
&nbsp;<span style="color: #483d8b;">'thebes'</span><span style="color: black;">&#93;</span></div>
</div>
</div>
<p></p>
<p>Note that better rhymes are listed first - according to the length of the match.<br />
To create this list I didn't use stress information, although with some more work it may be done. </p>
<p>Back to our limerick, we can see that "tabs" does not have really good rhymes. Better luck with indentation maybe: </p>
<div class="syntax_hilite">
<div id="python-4">
<div class="python">In <span style="color: black;">&#91;</span><span style="color: #ff4500;">86</span><span style="color: black;">&#93;</span>: words.<span style="color: #000000;">get_word_rhymes</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">"indentation"</span>, word_index, rhyme_index<span style="color: black;">&#41;</span><span style="color: black;">&#91;</span>:<span style="color: #ff4500;">20</span><span style="color: black;">&#93;</span><br />
Out<span style="color: black;">&#91;</span><span style="color: #ff4500;">86</span><span style="color: black;">&#93;</span>: <br />
<span style="color: black;">&#91;</span><span style="color: #483d8b;">'kishion'</span>, <span style="color: #483d8b;">'alleviation'</span>, <span style="color: #483d8b;">'expostulation'</span>,<br />
&nbsp;<span style="color: #483d8b;">'machination'</span>, <span style="color: #483d8b;">'syrophenician'</span>, <span style="color: #483d8b;">'proposition'</span>,<br />
&nbsp;<span style="color: #483d8b;">'infatuation'</span>, <span style="color: #483d8b;">'computation'</span>, <span style="color: #483d8b;">'mansion'</span>,<br />
&nbsp;<span style="color: #483d8b;">'meditation'</span>, <span style="color: #483d8b;">'aggression'</span>, <span style="color: #483d8b;">'anticipation'</span>,<br />
&nbsp;<span style="color: #483d8b;">'clarification'</span>, <span style="color: #483d8b;">'logician'</span>, <span style="color: #483d8b;">'gratulation'</span>,<br />
&nbsp;<span style="color: #483d8b;">'discretion'</span>, <span style="color: #483d8b;">'quotation'</span>, <span style="color: #483d8b;">'presentation'</span>,<br />
&nbsp;<span style="color: #483d8b;">'dissolution'</span>, <span style="color: #483d8b;">'deprecation'</span><span style="color: black;">&#93;</span></div>
</div>
</div>
<p></p>
<p>And we get (not the best limerick I admit):</p>
<blockquote><p>a man named guido once thought<br />
he'd invent a language well wrought<br />
with space indentation<br />
and good presentation<br />
we all got the language we sought</p></blockquote>
<p>My original ending line was "it left all the perl hackers distraught"... but it ain't true, so I gave it up. The 'distraught' was found with my script as well.<br />
If you want to look for your own rhymes, then you can use my <a href="http://www.algorithm.co.il/sitecode/words.tar.gz">hacked-up script</a>, although it isn't written well enough for my taste. (For example, don't expect to see documentation :)<br />
I'll upload a better version once I refactor it.<br />
To save you the trouble of generating the word index and the rhyme index from scratch, I used cPickle to <a href="http://www.algorithm.co.il/sitecode/word_index.cpkl.tar.gz">store</a> <a href="http://www.algorithm.co.il/sitecode/rhyme_index.cpkl.tar.gz">them</a>.  You can use them for lookups regardless of the script.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.algorithm.co.il/blogs/index.php/programming/python/rhyme-and-reason-with-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fibonacci meals</title>
		<link>http://www.algorithm.co.il/blogs/index.php/math/fibonacci-meals/</link>
		<comments>http://www.algorithm.co.il/blogs/index.php/math/fibonacci-meals/#comments</comments>
		<pubDate>Thu, 29 Nov 2007 13:51:12 +0000</pubDate>
		<dc:creator>lorg</dc:creator>
				<category><![CDATA[Humour]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.algorithm.co.il/blogs/index.php/math/fibonacci-meals/</guid>
		<description><![CDATA[Lately I've been reminded of the existence of Fibonacci meals. For a long time, I despised those, but now that I'm preparing my own food most of the time, I'm aiming for them, to save time cooking.
A Fibonacci meal is an element of a sequence defined to be:
a(0) = some food
a(1) = some food
a(n) = [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I've been reminded of the existence of Fibonacci meals. For a long time, I despised those, but now that I'm preparing my own food most of the time, I'm aiming for them, to save time cooking.</p>
<p>A Fibonacci meal is an element of a sequence defined to be:</p>
<pre>a(0) = some food
a(1) = some food
a(n) = a(n-1) + (a(n-2) as sauce)</pre>
<p>Very simple, and very effective. You can find those in various places, such as camps, school cafeteria, etc...</p>
<p>Generally this sequence does not converge, however there is a special case for cakes and desserts:</p>
<pre>c(0) = some cake or dessert
c(1) = some cake or dessert
c(n) = c(n-1) + (c(n-2) as icing)</pre>
<p>This sequence does converge, to the <strong>chocolate ball</strong>. (in Wikipedia,  <a href="http://en.wikipedia.org/wiki/Chokladboll">Chokladboll</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.algorithm.co.il/blogs/index.php/math/fibonacci-meals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Misunderstood humour &#8211; and NP-Completeness</title>
		<link>http://www.algorithm.co.il/blogs/index.php/misc/misunderstood-humour-and-np-completeness/</link>
		<comments>http://www.algorithm.co.il/blogs/index.php/misc/misunderstood-humour-and-np-completeness/#comments</comments>
		<pubDate>Wed, 18 Jul 2007 13:13:13 +0000</pubDate>
		<dc:creator>lorg</dc:creator>
				<category><![CDATA[Humour]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[computer science]]></category>

		<guid isPermaLink="false">http://www.algorithm.co.il/blogs/index.php/misc/misunderstood-humour-and-np-completeness/</guid>
		<description><![CDATA[One of the good xkcd comics that I liked. I tried showing it to other people, but almost nobody got it...
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.xkcd.com/c287.html">One of the good</a> <a href="http://www.xkcd.com/" title="xkcd - A webcomic of romance, sarcasm, math, and language.">xkcd</a> comics that I liked. I tried showing it to other people, but almost nobody got it...</p>
]]></content:encoded>
			<wfw:commentRss>http://www.algorithm.co.il/blogs/index.php/misc/misunderstood-humour-and-np-completeness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
