Blog RSS Feed

Archive for November, 2011

A Javascript Bible Passage Reference Parser

Friday, November 18th, 2011

Browse the Github repository of a new Bible-reference parser written in Coffeescript / Javascript (it understands text like “John 3:16”), try a demo, or review the annotated source. You can use the parser as-is or as a starting point for building your own–the source code includes 200,000 real-world passage references to give you a head start. It’s designed to handle how people actually type Bible references (typos and all) and tries hard to make sense of any input you give it.

From the readme:

This is the fourth complete Bible reference parser that I’ve written. It’s how I try out new programming languages: the first one was in PHP (2002), which saw production usage on a Bible search website from 2002-2011; the second in Perl (2007), which saw production usage on a Bible-related site starting in 2007; and the third in Ruby (2009), which never saw production usage because it was way too slow. This Coffeescript parser (at least on V8) is faster than the Perl one and 100 times faster than the Ruby one.

I chose Coffeescript out of curiosity–does it make Javascript that much more pleasant to work with? From a programming perspective, the easy loops and array comprehensions alone practically justify its use. From a readability perspective, the code is easier to follow (and come back to months later) than the equivalent Javascript–the tests, in particular, are much easier to follow without all the Javascript punctuation.

My main interest in open-sourcing and thoroughly documenting this code lies in giving future programmers data and code that they can use to build better parsers. While this code reflects my experience, it’s hardly the last word on the subject.

Jim LePage’s Illustrations of Every Bible Book

Friday, November 11th, 2011

Jim LePage has just finished a two-year project in which he’s created an illustration for every book of the Bible. The always-underappreciated Obadiah is my favorite:

A giant hand reaches for a bird, with the caption, “Though you soar like the eagle, I will bring you down. Obadiah.”

Jim also runs Gettin’ Biblical, a site that showcases non-schlocky Christian-themed artwork. I particularly enjoyed The Savior collage and the papercut-esque Burning Bush. Good examples of “Christian art” (a difficult term to define if you’ve ever talked to artists who are Christians) are hard to come by, and I appreciate Jim’s efforts to collect them.

Update September 2016: Removed outdated link to Gettin’ Biblical.