<?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>Lojic Technologies Blog &#187; people</title>
	<atom:link href="http://lojic.com/blog/category/people/feed/" rel="self" type="application/rss+xml" />
	<link>http://lojic.com/blog</link>
	<description></description>
	<lastBuildDate>Fri, 25 Nov 2011 20:12:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to Write a Spelling Corrector in Ruby</title>
		<link>http://lojic.com/blog/2008/09/04/how-to-write-a-spelling-corrector-in-ruby/</link>
		<comments>http://lojic.com/blog/2008/09/04/how-to-write-a-spelling-corrector-in-ruby/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 20:58:45 +0000</pubDate>
		<dc:creator>Brian Adkins</dc:creator>
				<category><![CDATA[people]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://lojic.com/blog/2008/09/04/how-to-write-a-spelling-corrector-in-ruby/</guid>
		<description><![CDATA[Peter Norvig wrote a simple spelling corrector in 20 lines of Python 2.5,
so I thought I&#8217;d see what it looks like in Ruby. Here are some areas I&#8217;m not pleased with:

List comprehensions in Python made the edits1 function more elegant IMO.
The boolean expression in the correct function evaluates empty sets/arrays as false in Python but [...]]]></description>
			<content:encoded><![CDATA[<p>Peter Norvig wrote a simple spelling corrector in 20 lines of Python 2.5,<br />
so I thought I&#8217;d see what it looks like in Ruby. Here are some areas I&#8217;m not pleased with:</p>
<ol>
<li>List comprehensions in Python made the edits1 function more elegant IMO.</li>
<li>The boolean expression in the correct function evaluates empty sets/arrays as false in Python but not in Ruby, so I had to add the &#8220;result.empty? ? nil : result&#8221; expression to several functions. I expect there&#8217;s a better way to handle this also.</li>
</ol>
<p>Otherwise, the translation was pretty straightforward.</p>
<p>Here&#8217;s a link to Norvig&#8217;s page:<br />
<a href="http://www.norvig.com/spell-correct.html">http://www.norvig.com/spell-correct.html</a></p>
<p>That page includes a link to a text file that I saved locally as<br />
holmes.txt: <a href="http://www.norvig.com/holmes.txt">http://www.norvig.com/holmes.txt</a></p>
<pre>
def words text
  text.downcase.scan(/[a-z]+/)
end

def train features
  model = Hash.new(1)
  features.each {|f| model[f] += 1 }
  return model
end

NWORDS = train(words(File.new('holmes.txt').read))
LETTERS = ("a".."z").to_a.join

def edits1 word
  n = word.length
  deletion = (0...n).collect {|i| word[0...i]+word[i+1..-1] }
  transposition = (0...n-1).collect {|i| word[0...i]+word[i+1,1]+word[i,1]+word[i+2..-1] }
  alteration = []
  n.times {|i| LETTERS.each_byte {|l| alteration << word[0...i]+l.chr+word[i+1..-1] } }
  insertion = []
  (n+1).times {|i| LETTERS.each_byte {|l| insertion << word[0...i]+l.chr+word[i..-1] } }
  result = deletion + transposition + alteration + insertion
  result.empty? ? nil : result
end

def known_edits2 word
  result = []
  edits1(word).each {|e1| edits1(e1).each {|e2| result << e2 if NWORDS.has_key?(e2) }}
  result.empty? ? nil : result
end

def known words
  result = words.find_all {|w| NWORDS.has_key?(w) }
  result.empty? ? nil : result
end

def correct word
  (known([word]) or known(edits1(word)) or known_edits2(word) or
    [word]).max {|a,b| NWORDS[a] <=> NWORDS[b] }
end
</pre>
<p>After you&#8217;ve saved the holmes.txt file, load the code into irb and call the correct function with a string as follows:</p>
<pre>
badkins:~/sync/code/ruby$ irb
irb(main):001:0> require 'spelling_corrector.rb'
=> true
irb(main):002:0> correct "whree"
=> "where"
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lojic.com/blog/2008/09/04/how-to-write-a-spelling-corrector-in-ruby/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Startup School 2008</title>
		<link>http://lojic.com/blog/2008/04/21/startup-school-2008/</link>
		<comments>http://lojic.com/blog/2008/04/21/startup-school-2008/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 17:22:05 +0000</pubDate>
		<dc:creator>Brian Adkins</dc:creator>
				<category><![CDATA[business]]></category>
		<category><![CDATA[people]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[startup]]></category>

		<guid isPermaLink="false">http://lojic.com/blog/2008/04/21/startup-school-2008/</guid>
		<description><![CDATA[http://omnisio.com/startupschool08
http://www.justin.tv/hackertv/97554/Startup_School
Peter Norvig, Paul Graham, Marc Andreessen, Mike Arrington, Jeff Bezos, David Heinemeier Hansson, etc.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://omnisio.com/startupschool08">http://omnisio.com/startupschool08</a></p>
<p><a href="http://www.justin.tv/hackertv/97554/Startup_School">http://www.justin.tv/hackertv/97554/Startup_School</a></p>
<p>Peter Norvig, Paul Graham, Marc Andreessen, Mike Arrington, Jeff Bezos, David Heinemeier Hansson, etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://lojic.com/blog/2008/04/21/startup-school-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Paul Graham on Procastination</title>
		<link>http://lojic.com/blog/2007/12/17/paul-graham-on-procastination/</link>
		<comments>http://lojic.com/blog/2007/12/17/paul-graham-on-procastination/#comments</comments>
		<pubDate>Tue, 18 Dec 2007 02:46:10 +0000</pubDate>
		<dc:creator>Brian Adkins</dc:creator>
				<category><![CDATA[business]]></category>
		<category><![CDATA[people]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://lojic.com/blog/2007/12/17/paul-graham-on-procastination/</guid>
		<description><![CDATA[
The most impressive people I know are all terrible procrastinators. So could it be that procrastination isn&#8217;t always bad?
Most people who write about procrastination write about how to cure it. But this is, strictly speaking, impossible. There are an infinite number of things you could be doing. No matter what you work on, you&#8217;re not [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>
The most impressive people I know are all terrible procrastinators. So could it be that procrastination isn&#8217;t always bad?</p>
<p>Most people who write about procrastination write about how to cure it. But this is, strictly speaking, impossible. There are an infinite number of things you could be doing. No matter what you work on, you&#8217;re not working on everything else. So the question is not how to avoid procrastination, but how to procrastinate well.
</p></blockquote>
<p>It&#8217;s ironic that I read <a href="http://www.paulgraham.com/procrastination.html">this essay</a> while procastinating :) To read the rest, click the previous link.</p>
]]></content:encoded>
			<wfw:commentRss>http://lojic.com/blog/2007/12/17/paul-graham-on-procastination/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BBC Richard Feynman Interview</title>
		<link>http://lojic.com/blog/2007/11/16/bbc-richard-feynman-interview/</link>
		<comments>http://lojic.com/blog/2007/11/16/bbc-richard-feynman-interview/#comments</comments>
		<pubDate>Fri, 16 Nov 2007 16:21:05 +0000</pubDate>
		<dc:creator>Brian Adkins</dc:creator>
				<category><![CDATA[people]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[science]]></category>

		<guid isPermaLink="false">http://lojic.com/blog/2007/11/16/bbc-richard-feynman-interview/</guid>
		<description><![CDATA[Although I disagree with Richard Feynman&#8217;s conclusions on some of the more important questions we can ask, no one can deny he is an interesting and amazing person. I&#8217;ve read a few biographical books about him, and they were quite entertaining. Here is a video interview he did for the BBC in 1981.
Although I&#8217;ve read [...]]]></description>
			<content:encoded><![CDATA[<p>Although I disagree with Richard Feynman&#8217;s conclusions on some of the more important questions we can ask, no one can deny he is an interesting and amazing person. I&#8217;ve read a few biographical books about him, and they were quite entertaining. Here is <a href="http://www.bbc.co.uk/sn/tvradio/programmes/horizon/broadband/archive/feynman/">a video interview</a> he did for the BBC in 1981.</p>
<p>Although I&#8217;ve read a fair amount about him, this was the first time I heard his voice. I noticed he sounds very much like Regis Philbin :)</p>
<p><strong>UPDATE:</strong><br />
Here are a few more BBC <a href="http://www.bbc.co.uk/sn/tvradio/programmes/horizon/broadband/">video links:</a></p>
]]></content:encoded>
			<wfw:commentRss>http://lojic.com/blog/2007/11/16/bbc-richard-feynman-interview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Peter Seibel’s “Practical Common Lisp” Google Talk</title>
		<link>http://lojic.com/blog/2007/08/04/peter-seibels-practical-common-lisp-google-talk/</link>
		<comments>http://lojic.com/blog/2007/08/04/peter-seibels-practical-common-lisp-google-talk/#comments</comments>
		<pubDate>Sat, 04 Aug 2007 06:15:05 +0000</pubDate>
		<dc:creator>Brian Adkins</dc:creator>
				<category><![CDATA[books]]></category>
		<category><![CDATA[people]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[lisp]]></category>

		<guid isPermaLink="false">http://lojic.com/blog/?p=101</guid>
		<description><![CDATA[Here&#8217;s Peter Seibel&#8217;s &#8220;Practical Common Lisp&#8221; talk at Google (about an hour):

Google Video Link
]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s Peter Seibel&#8217;s &#8220;Practical Common Lisp&#8221; talk at Google (about an hour):</p>
<p><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/Ge8PxdluVw8"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/Ge8PxdluVw8" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object></p>
<p><a href="http://video.google.com/videoplay?docid=448441135356213813">Google Video Link</a></p>
]]></content:encoded>
			<wfw:commentRss>http://lojic.com/blog/2007/08/04/peter-seibels-practical-common-lisp-google-talk/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

