@creativeorange/azure-text-to-speech 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -8737,8 +8737,15 @@ class TextToSpeech {
8737
8737
  if (this.url !== "") {
8738
8738
  ssml += `<lexicon uri="${this.url}"/>`;
8739
8739
  }
8740
- ssml += `<prosody rate="${this.rate}%" pitch="${this.pitch}%">${text}</prosody></voice></speak>`;
8740
+ ssml += `<prosody rate="${this.rate}%" pitch="${this.pitch}%">
8741
+ ${this.convertHtmlEntities(text)}
8742
+ </prosody></voice></speak>`;
8741
8743
  return ssml;
8742
8744
  }
8745
+ convertHtmlEntities(input) {
8746
+ const p = document.createElement(`p`);
8747
+ p.textContent = input;
8748
+ return p.innerHTML;
8749
+ }
8743
8750
  }
8744
8751
  export { SpeechToText, TextToSpeech };
@@ -24,4 +24,6 @@ File System access not available, please use Push or PullAudioOutputStream`),thi
24
24
  xmlns:emo="http://www.w3.org/2009/10/emotionml"
25
25
  version="1.0"
26
26
  xml:lang="en-US">
27
- <voice name="${this.voice}">`;return this.url!==""&&(t+=`<lexicon uri="${this.url}"/>`),t+=`<prosody rate="${this.rate}%" pitch="${this.pitch}%">${e}</prosody></voice></speak>`,t}}_.SpeechToText=Nr,_.TextToSpeech=xr,Object.defineProperties(_,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
27
+ <voice name="${this.voice}">`;return this.url!==""&&(t+=`<lexicon uri="${this.url}"/>`),t+=`<prosody rate="${this.rate}%" pitch="${this.pitch}%">
28
+ ${this.convertHtmlEntities(e)}
29
+ </prosody></voice></speak>`,t}convertHtmlEntities(e){const t=document.createElement("p");return t.textContent=e,t.innerHTML}}_.SpeechToText=Nr,_.TextToSpeech=xr,Object.defineProperties(_,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@creativeorange/azure-text-to-speech",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "main": "dist/co-azure-tts.umd.js",
5
5
  "browser": "dist/co-azure-tts.es.js",
6
6
  "scripts": {
@@ -370,7 +370,16 @@ export class TextToSpeech {
370
370
  ssml += `<lexicon uri="${this.url}"/>`;
371
371
  }
372
372
 
373
- ssml += `<prosody rate="${this.rate}%" pitch="${this.pitch}%">${text}</prosody></voice></speak>`;
373
+ ssml += `<prosody rate="${this.rate}%" pitch="${this.pitch}%">
374
+ ${this.convertHtmlEntities(text)}
375
+ </prosody></voice></speak>`;
374
376
  return ssml;
375
377
  }
378
+
379
+ convertHtmlEntities(input: string) {
380
+ const p = document.createElement(`p`);
381
+ p.textContent = input;
382
+
383
+ return p.innerHTML;
384
+ }
376
385
  }