Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -47,6 +47,11 @@ def transcribe_mic(audio_microphone, language):
|
|
47 |
}
|
48 |
transcription = re.sub(r"\b(un|l|d|s|t|m|c|n|quest|all|dall|nell|sull|coll|pell)\s+(?=[aeiouhàèìòùáéíóú])", r"\1'", transcription)
|
49 |
transcription = re.sub(r"\b(s|t|m|c|n)\s+(?=è\b|ha\b|hanno\b)", r"\1'", transcription)
|
|
|
|
|
|
|
|
|
|
|
50 |
for phrase in no_elision_cases:
|
51 |
fixed = phrase.replace(" ", "'")
|
52 |
transcription = transcription.replace(fixed, phrase)
|
|
|
47 |
}
|
48 |
transcription = re.sub(r"\b(un|l|d|s|t|m|c|n|quest|all|dall|nell|sull|coll|pell)\s+(?=[aeiouhàèìòùáéíóú])", r"\1'", transcription)
|
49 |
transcription = re.sub(r"\b(s|t|m|c|n)\s+(?=è\b|ha\b|hanno\b)", r"\1'", transcription)
|
50 |
+
transcription = re.sub(r"\bpo\b", "po'", transcription)
|
51 |
+
transcription = re.sub(r"\b(senz) ([aeiou])", r"\1'\2", transcription)
|
52 |
+
pattern_numbers = r"\b(trenta|quaranta|cinquanta|sessanta|settanta|ottanta|novanta)\s+(?=anni|ore)\b"
|
53 |
+
replacement_numbers = lambda m: m.group(1)[:-1] + "’" + m.group(0).split()[1]
|
54 |
+
transcription = re.sub(pattern_numbers, replacement_numbers, transcription)
|
55 |
for phrase in no_elision_cases:
|
56 |
fixed = phrase.replace(" ", "'")
|
57 |
transcription = transcription.replace(fixed, phrase)
|