Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correctly strip/restore initial punctuation #3336

Merged
merged 3 commits into from
Nov 30, 2023
Merged

Conversation

eginhard
Copy link
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
53 checks passed
@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