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

Separate punctuation by whitespace #6574

Merged
merged 1 commit into from
May 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions nemo/collections/asr/parts/utils/transcribe_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def __init__(self, punctuation_marks: str):
def separate_punctuation(self, lines: List[str]) -> List[str]:
if self.regex_punctuation is not None:
return [
self.regex_extra_space.sub('', self.regex_punctuation.sub(r' \1 ', line)).strip() for line in lines
self.regex_extra_space.sub(' ', self.regex_punctuation.sub(r' \1 ', line)).strip() for line in lines
]
else:
return lines
Expand All @@ -470,7 +470,7 @@ def do_lowercase(self, lines: List[str]) -> List[str]:

def rm_punctuation(self, lines: List[str]) -> List[str]:
if self.regex_punctuation is not None:
return [self.regex_extra_space.sub('', self.regex_punctuation.sub(' ', line)).strip() for line in lines]
return [self.regex_extra_space.sub(' ', self.regex_punctuation.sub(' ', line)).strip() for line in lines]
else:
return lines

Expand Down
Loading