Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -86,8 +86,11 @@ def compare_texts(reference_text, transcribed_text):
|
|
86 |
if incorrect_words_audios:
|
87 |
html_output += "<br><strong>Pronunciation for Incorrect Words:</strong><br>"
|
88 |
for word, audio in incorrect_words_audios:
|
|
|
|
|
89 |
html_output += f'{word}: '
|
90 |
-
html_output += f'<audio controls><source src="{audio}" type="audio/mpeg">Your browser does not support the audio tag.</audio
|
|
|
91 |
|
92 |
return html_output
|
93 |
|
|
|
86 |
if incorrect_words_audios:
|
87 |
html_output += "<br><strong>Pronunciation for Incorrect Words:</strong><br>"
|
88 |
for word, audio in incorrect_words_audios:
|
89 |
+
suggestion = difflib.get_close_matches(word, reference_words, n=1)
|
90 |
+
suggestion_text = f" (Did you mean: <em>{suggestion[0]}</em>?)" if suggestion else ""
|
91 |
html_output += f'{word}: '
|
92 |
+
html_output += f'<audio controls><source src="{audio}" type="audio/mpeg">Your browser does not support the audio tag.</audio>{suggestion_text}<br>'
|
93 |
+
|
94 |
|
95 |
return html_output
|
96 |
|