The other day I was working with Google’s Web Speech API to get some spoken messages for my snooker scoreboard program, which I’m currently developing using Angular 1.5.8 (more on that project later…).
In snooker when a break ends, you say the name of the player, followed by the size of the break. So if Brian made a break of 4 one would say “Brian 4”, however I found that some specific names would trigger some very odd behaviour – mine included. Instead of simply speaking “Daniel 4” it would speak “Daniel chapter 4”.
var msg = new SpeechSynthesisUtterance('Daniel 4');
I was baffled to say the least and tried a few common names, and the names “John” and “Daniel” both triggered the “chapter” insert, but I could not figure out what could link these two words together.
Although I believe StackOverflow to be godsent, I’m against posting any kind of question until I’ve tried to figure it out on my own for at least a few hours – and I did, with no result, so I posted a question fearing that I’d missed something completely obvious.
Shortly after, a plausible answer arrived: It turns out to be a biblical reference to the Book of Daniel.
I fixed the problem by adding a comma between the name and the letter, but I’m still very surprised to find this “feature” in a Public Google Web API. I had never thought that religion would play a part in my code, but at least there was an easy fix.