<?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.co.il &#187; Humour</title>
	<atom:link href="http://www.algorithm.co.il/blogs/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>Tue, 21 Jun 2011 20:37:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>And now for something completely different</title>
		<link>http://www.algorithm.co.il/blogs/humour/and-now-for-something-completely-different/</link>
		<comments>http://www.algorithm.co.il/blogs/humour/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[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[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.algorithm.co.il/blogs/humour/and-now-for-something-completely-different/' addthis:title='And now for something completely different'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>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 &#8230; <a href="http://www.algorithm.co.il/blogs/humour/and-now-for-something-completely-different/">Continue reading <span class="meta-nav">&#8594;</span></a><div class="addthis_toolbox addthis_default_style " addthis:url='http://www.algorithm.co.il/blogs/humour/and-now-for-something-completely-different/' addthis:title='And now for something completely different' ><a href="http://addthis.com/bookmark.php?v=250&#38;username=xa-4d2b47597ad291fb" class="addthis_button_compact">Share</a><span class="addthis_separator">&#124;</span><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a></div>]]></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/humour/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/humour/rhyme-and-reason-with-python/</link>
		<comments>http://www.algorithm.co.il/blogs/humour/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[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[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.algorithm.co.il/blogs/humour/rhyme-and-reason-with-python/' addthis:title='Rhyme and Reason with Python'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>After reading xkcd&#8217;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, &#8230; <a href="http://www.algorithm.co.il/blogs/humour/rhyme-and-reason-with-python/">Continue reading <span class="meta-nav">&#8594;</span></a><div class="addthis_toolbox addthis_default_style " addthis:url='http://www.algorithm.co.il/blogs/humour/rhyme-and-reason-with-python/' addthis:title='Rhyme and Reason with Python' ><a href="http://addthis.com/bookmark.php?v=250&#38;username=xa-4d2b47597ad291fb" class="addthis_button_compact">Share</a><span class="addthis_separator">&#124;</span><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a></div>]]></description>
			<content:encoded><![CDATA[<p>After reading <a href="http://blag.xkcd.com/2008/02/04/limerickdbcom/">xkcd&#8217;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&#8217;d invent a language well wrought<br />
indentation as tabs</p></blockquote>
<p>Uhm, no luck there&#8230; &#8220;tabs&#8221; does not rhyme well. Then an idea came&#8230; 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> &#8211; 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="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">In <span style="color: black;">&#91;</span><span style="color: #ff4500;">84</span><span style="color: black;">&#93;</span>: words.<span style="color: black;">get_word_rhymes</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;tabs&quot;</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>
Out<span style="color: black;">&#91;</span><span style="color: #ff4500;">84</span><span style="color: black;">&#93;</span>:
<span style="color: black;">&#91;</span><span style="color: #483d8b;">'crabs'</span>, <span style="color: #483d8b;">'stabs'</span>, <span style="color: #483d8b;">'macnabs'</span>,
 <span style="color: #483d8b;">'dabs'</span>, <span style="color: #483d8b;">'cabs'</span>, <span style="color: #483d8b;">'scabs'</span>,
 <span style="color: #483d8b;">'slabs'</span>, <span style="color: #483d8b;">'arabs'</span>, <span style="color: #483d8b;">'snobs'</span>,
 <span style="color: #483d8b;">'thebes'</span><span style="color: black;">&#93;</span></pre></div></div>

<p>Note that better rhymes are listed first &#8211; according to the length of the match.<br />
To create this list I didn&#8217;t use stress information, although with some more work it may be done.</p>
<p>Back to our limerick, we can see that &#8220;tabs&#8221; does not have really good rhymes. Better luck with indentation maybe:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">In <span style="color: black;">&#91;</span><span style="color: #ff4500;">86</span><span style="color: black;">&#93;</span>: words.<span style="color: black;">get_word_rhymes</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;indentation&quot;</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>
Out<span style="color: black;">&#91;</span><span style="color: #ff4500;">86</span><span style="color: black;">&#93;</span>:
<span style="color: black;">&#91;</span><span style="color: #483d8b;">'kishion'</span>, <span style="color: #483d8b;">'alleviation'</span>, <span style="color: #483d8b;">'expostulation'</span>,
 <span style="color: #483d8b;">'machination'</span>, <span style="color: #483d8b;">'syrophenician'</span>, <span style="color: #483d8b;">'proposition'</span>,
 <span style="color: #483d8b;">'infatuation'</span>, <span style="color: #483d8b;">'computation'</span>, <span style="color: #483d8b;">'mansion'</span>,
 <span style="color: #483d8b;">'meditation'</span>, <span style="color: #483d8b;">'aggression'</span>, <span style="color: #483d8b;">'anticipation'</span>,
 <span style="color: #483d8b;">'clarification'</span>, <span style="color: #483d8b;">'logician'</span>, <span style="color: #483d8b;">'gratulation'</span>,
 <span style="color: #483d8b;">'discretion'</span>, <span style="color: #483d8b;">'quotation'</span>, <span style="color: #483d8b;">'presentation'</span>,
 <span style="color: #483d8b;">'dissolution'</span>, <span style="color: #483d8b;">'deprecation'</span><span style="color: black;">&#93;</span></pre></div></div>

<p>And we get (not the best limerick I admit):</p>
<blockquote><p>a man named guido once thought<br />
he&#8217;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 &#8220;it left all the perl hackers distraught&#8221;&#8230; but it ain&#8217;t true, so I gave it up. The &#8216;distraught&#8217; 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&#8217;t written well enough for my taste. (For example, don&#8217;t expect to see documentation :)<br />
I&#8217;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/humour/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/humour/fibonacci-meals/</link>
		<comments>http://www.algorithm.co.il/blogs/humour/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[Personal]]></category>

		<guid isPermaLink="false">http://www.algorithm.co.il/blogs/index.php/math/fibonacci-meals/</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.algorithm.co.il/blogs/humour/fibonacci-meals/' addthis:title='Fibonacci meals'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Lately I&#8217;ve been reminded of the existence of Fibonacci meals. For a long time, I despised those, but now that I&#8217;m preparing my own food most of the time, I&#8217;m aiming for them, to save time cooking. A Fibonacci meal &#8230; <a href="http://www.algorithm.co.il/blogs/humour/fibonacci-meals/">Continue reading <span class="meta-nav">&#8594;</span></a><div class="addthis_toolbox addthis_default_style " addthis:url='http://www.algorithm.co.il/blogs/humour/fibonacci-meals/' addthis:title='Fibonacci meals' ><a href="http://addthis.com/bookmark.php?v=250&#38;username=xa-4d2b47597ad291fb" class="addthis_button_compact">Share</a><span class="addthis_separator">&#124;</span><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a></div>]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been reminded of the existence of Fibonacci meals. For a long time, I despised those, but now that I&#8217;m preparing my own food most of the time, I&#8217;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&#8230;</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/humour/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/humour/misunderstood-humour-and-np-completeness/</link>
		<comments>http://www.algorithm.co.il/blogs/humour/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[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[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.algorithm.co.il/blogs/humour/misunderstood-humour-and-np-completeness/' addthis:title='Misunderstood humour &#8211; and NP-Completeness'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>One of the good xkcd comics that I liked. I tried showing it to other people, but almost nobody got it&#8230;<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.algorithm.co.il/blogs/humour/misunderstood-humour-and-np-completeness/' addthis:title='Misunderstood humour &#8211; and NP-Completeness' ><a href="http://addthis.com/bookmark.php?v=250&#38;username=xa-4d2b47597ad291fb" class="addthis_button_compact">Share</a><span class="addthis_separator">&#124;</span><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a></div>]]></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&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.algorithm.co.il/blogs/humour/misunderstood-humour-and-np-completeness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

