From 811cec6c9384f3ba5756cf01bf7fa2656cf87e83 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Wed, 5 Oct 2022 17:55:10 +0800 Subject: [PATCH] add space to the end of sentence --- packages/text-to-speech/src/htmlToSsml.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/text-to-speech/src/htmlToSsml.ts b/packages/text-to-speech/src/htmlToSsml.ts index de785f744..ef9d6af6e 100644 --- a/packages/text-to-speech/src/htmlToSsml.ts +++ b/packages/text-to-speech/src/htmlToSsml.ts @@ -313,6 +313,10 @@ const textToUtterances = ({ // use nlp lib to detect sentences and // avoid splitting words and sentences sentences.forEach((sentence, i) => { + if (i < sentences.length - 1) { + // add space to the end of sentence + sentence += ' ' + } const nextText = currentText + sentence if (nextText.length > MAX_CHARS) { if (currentText.length > 0) {