DEV Community

MakeInterview
MakeInterview

Posted on

I open-sourced the counting tool, and it immediately caught two of its own bugs

I published a count a while back: the King James Bible says "fear not" 62 times, not the 365 the wall art claims. Then I turned the counting code into a small open-source tool — and the first thing it did was prove itself wrong.

Two bugs, both silent

Bug one: substrings. A naive search for fear also matches fearful, fearfulness, and God-fearing. That inflates a raw count by roughly 15% and looks completely reasonable on the screen.

Bug two: punctuation as glue. I normalised away punctuation so fear not. and fear not would match. But stripping punctuation also turns 1 Peter 2:18 —

Servants, be subject to your masters with all fear; not only to the good and gentle...

— into the string ...all fear not only..., which contains the phrase "fear not" even though the verse does not say it. One false positive, from a semicolon.

Neither bug threw an error. Both produced a plausible number. I only caught them because the tool runs over the whole corpus and asserts its output against a published per-verse audit trail.

Why I ship the corpus, not just the number

The repo includes the full KJV (31,102 verses) and the Chinese Union Version (31,100 verses), plus a test that re-derives every published count:

node test.mjs
# ok — tool and audit trail agree over the full KJV (31,102 v) and CUV (31,100 v)
Enter fullscreen mode Exit fullscreen mode

A count with a stated rule can be checked, corrected, and cited. A count without one is a rumor with a decimal point. The rule here is explicit: whole words not substrings, whitespace joins words and punctuation never does, verses for phrase claims and occurrences for word claims, and every rule reported separately instead of silently merged.

The takeaway for anyone publishing a number

If you publish a number, publish the rule that produced it next to the number, and publish the rows so someone can diff your work instead of trusting it. The two bugs above are not exotic. They are what happens when a number travels without its method.

Links

If you find an error in my count, I would genuinely like to know — that is the whole point of putting the method where people can argue with it.

I built the counting pipeline while working on TrustBible, a Bible Q&A tool that quotes the exact verses it cites.

Top comments (0)