I need to pre-process a speech transcript for forced-alignment. However, I am having difficulty with replacing year with text representation. For example, 1984 needs to be replaced with "nineteen eighty four". I tried the replace_number function of the qdap package. The package is awesome, but it replaces 1984 with "one thousand nine hundred eighty four" instead. Are there other functions from any R packages that may I try? Thanks!
you can split each into two parts and separately convert each part to a character representation:
year = 1984
paste(
replace_number(substr(as.character(year), 1, 2),
replace_number(substr(as.character(year), 3, 4)
)
this would yield nineteen eightyfour