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

Change ticks --> apostrophes #101

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 11 additions & 1 deletion src/corporacreator/preprocessors/en.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,15 @@ def en(client_id, sentence):
Returns:
(str): Cleaned up sentence. Returning None or a `str` of whitespace flags the sentence as invalid.
"""
# TODO: Clean up en data
if client_id == "f2909ec9143e4ff4792b0ccb2e109da938c1c5bfc91641165b0fd32f6caf67ad234318233affcaa4117a36212440eae89dbf06c75e2cb9d4a19ddec3663044ac":
sentence = sentence.replace("=", "equal to")
if client_id == "3c8f07827758e9ce8070ed287139d6d3e6457c1c16dcb972edac76c4d4333dc9e9c428711237e2b34fa29f4d249287fd238ac884534e33075958233643bbd0a1":
sentence = sentence.replace("C++", "C plus plus")
## collapse all apostrophe-like marks
## e.g. common_voice_en_18441344.mp3 ‘I’m not a serpent!’ --> 'I'm not a serpent!'
sentence = sentence.replace("’","'") # right-ticks --> apostrophes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this always the right thing to do? For instance see here.

sentence = sentence.replace("‘","'") # left-ticks --> apostrophes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd guess I'd pose a similar question here.

## Change em-dash to dash
## e.g. common_voice_en_18607891.mp3 Nelly, come here — is it morning? --> Nelly, come here – is it morning?
sentence = sentence.replace("—","–")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here; em-dash is used in cases where dash is not used and vice versa. For instance see here.

return sentence