v1 Polish: Hindi anusvara normalizer, de-buzz filter, --dur_weight/--prior_weight & Parquet curator
Browse files49 unmodified lines5051525354555657585960616263646566676869707149 unmodified lines text = re.sub(r"\s+", " ", text).strip() return text
@staticmethod def normalize_hindi_pronunciation(text: str) -> str: """ Resolves word-medial Hindi anusvara (ं) before stop consonants into explicit half-nasal consonants (न्/म्/ण्/ञ्) so raw-character models pronounce words like 'ईंधन' ('ईन्धन'), 'कंबल' ('कम्बल'), 'ठंड' ('ठण्ड') accurately. Leaves word-final nasalization ('मैं', 'हूं', 'गांव', 'बच्चों') untouched. """ if not text: return text text = re.sub(r"ं(?=[तथदधन])", "न्", text) text = re.sub(r"ं(?=[पफबभम])", "म्", text) text = re.sub(r"ं(?=[टठडढण])", "ण्", text) text = re.sub(r"ं(?=[चछजझञ])", "ञ्", text) return text
def text_to_ids(self, text: str) -> torch.Tensor: """Encodes text to a 1D tensor of token IDs in range [2, 480].""" text = self.clean_text(text)data/text_cleaner.py+16