Part of the Similar Diversity work includes a visualization of the word you in various holy books. This visualization provided me the impetus to produce something more interactive for the Bible.
How It Works
First, I counted the number of words in the ESV Bible (767,847, including headings but excluding footnotes, if you’re interested).
Next I assigned each word in the Bible a unique, incremented number. Then it was just a matter of going through the positions and grouping them by word. The result is a database table with two columns: word (varchar(18)) and positions (mediumtext). The positions column consists of a space-separated string of numbers.
When you enter a search query, the program finds the positions of words matching your query and then plots those positions on a chart. (The chart is 1/4 the size it would be if each word position got one pixel; it would have to be 1,083×709 pixels at a one-pixel-per-word ratio.)
The code is in PHP, using the GD library. I decided this project would be a good time to try out the SQLite database that comes with PHP instead of going with MySQL. I have no complaints, though Perl creates incompatible tables with current PHP versions (5.2.4) unless you use PDO in PHP to access the tables. It worked fine after a bit of Googling revealed the workaround.
Since the chart is 1/4 full-size, each pixel represents four words, and each dot occupies nine pixels. Given the coarse resolution, it’s best to use the locator to identify trends and then switch to the Bible text for further analysis.
It doesn’t do exact matches, only beginning-of-word matches. Only want to search for Eve, omitting results for evening? You’re out of luck.
It would be interesting to be able to click a dot and see the context of each occurrence.