diff --git a/index.js b/index.js index 4888873..e565bb6 100644 --- a/index.js +++ b/index.js @@ -147,6 +147,8 @@ function generateUtterances(str, slots, dictionary, exhaustiveUtterances) { utterance = utterance.replace(/\{(.*?)\}/g,function(match,p1){ return (isSlotLiteral(match)) ? match : "{"+values[slotmap[p1]]+"|"+p1+"}"; }); + //replace all extra spaces within the utterance that could create an issue when trying to recite them. + utterance = utterance.replace(/ +/g, " "); utterances.push( utterance ); }); }