David,

You have a hard problem to solve here.

"In 814 Charlemagne died"
   -> Eight fourteen

"In the year of our lord 814 ..."
   -> Eight hundred and fourteen

"In 814 cases out of 1000 the patient recovered"
   -> Eight hundred and fourteen

Oh, it can never be perfect, that's for sure. My initial thought was to use a range from 1000 to 2999 (as that would be a trivial regex), which lets you go back as far as the Battle of Hastings, and forward nearly a thousand years. It's still ambiguous, of course, but hopefully people would use commas in four-digit numbers that aren't supposed to be years. And, taking Daniel's suggestion makes it better, in that you can just turn off years if you don't want that sort of expansion. But something like "in 1994 there were 1994 reported cases" is always going to fail. Nothing to do but try to make that prominent in the documentation.


                -- Buddy

Reply via email to