From 920e7659193fbbdd1a58292be6e4a2275f8b1568 Mon Sep 17 00:00:00 2001 From: Renzo Trigoso Date: Wed, 14 Sep 2016 15:32:23 -0400 Subject: [PATCH] added replace to remove extra spaces created when using optional keywords --- index.js | 2 ++ 1 file changed, 2 insertions(+) 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 ); }); }