Skip to content

fix: correctly strip/restore initial punctuation - #3336

Merged
erogol merged 3 commits into
coqui-ai:devfrom
idiap:punc
Nov 30, 2023
Merged

fix: correctly strip/restore initial punctuation#3336
erogol merged 3 commits into
coqui-ai:devfrom
idiap:punc

Conversation

@eginhard

Copy link
Copy Markdown
Contributor

Fixes #3333. Stripping and restoring initial punctuation didn't work correctly because the string-splitting caused an additional empty string to be inserted in the text list (because ".A".split(".") => ["", "A"]). Now, an initial empty string is skipped and relevant test cases are added.

I also removed some orphaned code to make the rest easier to understand.

The case of lone punctuation is already handled at the top of restore(). The
removed if statement would never be called and would in fact raise an
AttributeError because the _punc_index named tuple doesn't have the attribute
`mark`.
Stripping and restoring initial punctuation didn't work correctly because the
string-splitting caused an additional empty string to be inserted in the text
list (because `".A".split(".")` => `["", "A"]`). Now, an initial empty string is
skipped and relevant test cases are added.

Fixes coqui-ai#3333
@erogol
erogol merged commit 39321d0 into coqui-ai:dev Nov 30, 2023
@eginhard
eginhard deleted the punc branch March 30, 2024 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Punctuation restoration works incorrect

2 participants