Spaces:
Runtime error
Runtime error
Update normalizer.py
Browse files- normalizer.py +0 -23
normalizer.py
CHANGED
@@ -353,29 +353,6 @@ class Normalizer:
|
|
353 |
print(f"An error occurred during character repetition removal: {e}")
|
354 |
return word
|
355 |
|
356 |
-
def translate_text(self, text: str) -> str:
|
357 |
-
"""
|
358 |
-
Translate the given text to English and return the translated text.
|
359 |
-
|
360 |
-
Args:
|
361 |
-
- text (str): The text to translate.
|
362 |
-
|
363 |
-
Returns:
|
364 |
-
- str: The translated text.
|
365 |
-
"""
|
366 |
-
try:
|
367 |
-
loop = asyncio.get_event_loop()
|
368 |
-
translated_text = (
|
369 |
-
loop.run_until_complete(self._translator.translate(text))
|
370 |
-
.text.lower()
|
371 |
-
.strip()
|
372 |
-
)
|
373 |
-
except Exception as e:
|
374 |
-
print(f"Text Translation failed: {e}")
|
375 |
-
translated_text = (
|
376 |
-
text.lower().strip()
|
377 |
-
) # Use original text if translation fails
|
378 |
-
return translated_text
|
379 |
|
380 |
def check_spelling(self, query: str) -> str:
|
381 |
"""
|
|
|
353 |
print(f"An error occurred during character repetition removal: {e}")
|
354 |
return word
|
355 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
|
357 |
def check_spelling(self, query: str) -> str:
|
358 |
"""
|