speak.js icon indicating copy to clipboard operation
speak.js copied to clipboard

Changing pronunciation?

Open JamesSeddonClaro opened this issue 9 years ago • 1 comments

I'm building a speaking calculator, so I need to change how speak.js reads the numeric function characters (+, -, *, /) to plus, minus, times and divide.

*Plus already works

JamesSeddonClaro avatar Apr 20 '16 15:04 JamesSeddonClaro

you can replace it in text before read it:

var translation = {
  '+':'plus',
  '-': 'minus',
  '*': 'times',
  '/': 'divide'
}
var myTranslatedText = mytext.replace(/[-+/*]/g, (a) => ' ' + replacer[a] + ' ')
meSpeak.speak(myTranslated)

yukulele avatar May 18 '17 19:05 yukulele