Skip to content

Commit

Permalink
fix(core): split error on single sentence
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Jan 13, 2025
1 parent 25cf2bc commit b5e452e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions ChatTTS/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,15 @@ def infer(
if "\n" in text:
text = text.split("\n")
else:
text = re.split(r"(?<=[。(.\s)])", text)
text = re.split(r"(?<=。)|(?<=\.\s)", text)
nt = []
for t in text:
if t:
nt.append(t)
text = nt
if isinstance(text, list):
for t in text:
if t:
nt.append(t)
text = nt
else:
text = [text]
self.logger.info("split text into %d parts", len(text))
self.logger.debug("%s", str(text))

Expand Down

0 comments on commit b5e452e

Please sign in to comment.