Maybe this, inspired by Josh O'Brien's answer, does it:
x <- "I like 346 ice cream cones. They're 99 percent good! I ate 46."
numDF <- structure(c("346", "99", "46", "three hundred forty six", "ninety nine",
"forty six"), .Dim = c(3L, 2L), .Dimnames = list(c("1", "2",
"3"), c("symbol", "text")))
pat <- paste(numDF[,"symbol"], collapse="|")
repeat {
m <- regexpr(pat, x)
if(m==-1) break
sym <- regmatches(x,m)
regmatches(x,m) <- numDF[match(sym, numDF[,"symbol"]), "text"]
}
x
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…