Skip to content

Commit

Permalink
Add SSML removal to async client as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Anderson authored and Bryan Anderson committed Jul 29, 2024
1 parent 78c6188 commit 2935d38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
7 changes: 4 additions & 3 deletions pyht/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,10 @@ async def _tts(
lease_data = self._lease.data

if isinstance(text, str):
text = split_text(normalize(text))
else:
text = [normalize(x) for x in text]
text = split_text(text)
if self._advanced.remove_ssml_tags:
text = [re.sub(r'<[^>]*>', '', x) for x in text]
text = [normalize(x) for x in text]
text = ensure_sentence_end(text)

request = api_pb2.TtsRequest(params=options.tts_params(text, voice_engine), lease=lease_data)
Expand Down
9 changes: 4 additions & 5 deletions pyht/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,11 @@ def _tts(
lease_data = self._lease.data

if isinstance(text, str):
text = split_text(normalize(text))
else:
text = [normalize(x) for x in text]
text = ensure_sentence_end(text)
text = split_text(text)
if self._advanced.remove_ssml_tags:
text = [normalize(re.sub(r'<[^>]*>', '', x)) for x in text]
text = [re.sub(r'<[^>]*>', '', x) for x in text]
text = [normalize(x) for x in text]
text = ensure_sentence_end(text)

request = api_pb2.TtsRequest(params=options.tts_params(text, voice_engine), lease=lease_data)

Expand Down

0 comments on commit 2935d38

Please sign in to comment.