Skip to content
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
5 changes: 3 additions & 2 deletions egs/commonvoice/ASR/local/preprocess_commonvoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def normalize_text(utt: str, language: str) -> str:
if language == "en":
return re.sub(r"[^a-zA-Z\s]", "", utt).upper()
elif language == "fr":
return re.sub(r"[^A-ZÀÂÆÇÉÈÊËÎÏÔŒÙÛÜ' ]", "", utt).upper()
utt = utt.upper()
return re.sub(r"[^A-ZÀÂÆÇÉÈÊËÎÏÔŒÙÛÜ' ]", "", utt)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The French uppercase letter Ÿ (corresponding to lowercase ÿ) is missing from the allowed characters list in the regular expression. Although rare, it is used in French proper nouns (e.g., L'Haÿ-les-Roses, Moÿ-de-l'Aisne). Without it, any occurrence of ÿ or Ÿ will be silently stripped after conversion to uppercase.

Adding Ÿ to the character class ensures complete coverage of French alphabet diacritics.

Suggested change
return re.sub(r"[^A-ZÀÂÆÇÉÈÊËÎÏÔŒÙÛÜ' ]", "", utt)
return re.sub(r"[^A-ZÀÂÆÇÉÈÊËÎÏÔŒÙÛÜŸ' ]", "", utt)

elif language == "pl":
return re.sub(r"[^a-ząćęłńóśźżA-ZĄĆĘŁŃÓŚŹŻ' ]", "", utt).upper()
elif language in ["yue", "zh-HK"]:
Expand Down Expand Up @@ -139,7 +140,7 @@ def preprocess_commonvoice(
if partition == "validated":
logging.warning(
"""
The 'validated' partition contains the data of both 'train', 'dev'
The 'validated' partition contains the data of both 'train', 'dev'
and 'test' partitions. We filter out the 'dev' and 'test' partition
here.
"""
Expand Down
Loading