Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -469,10 +469,14 @@ def correct_dash_usage(text):
|
|
469 |
if text.count('"') == 1:
|
470 |
text = text.replace('"', '')
|
471 |
|
472 |
-
# Step 6:
|
|
|
|
|
|
|
|
|
473 |
text = re.sub(r'(\d+)[kкКK]', r'\1 000', text, flags=re.IGNORECASE)
|
474 |
|
475 |
-
# Step
|
476 |
greeting_patterns = [
|
477 |
r"привет\b", r"здравствуй", r"добрый\s(день|вечер|утро)",
|
478 |
r"дорогой\b", r"уважаемый\b", r"дорогая\b", r"уважаемая\b",
|
|
|
469 |
if text.count('"') == 1:
|
470 |
text = text.replace('"', '')
|
471 |
|
472 |
+
# Step 6: Remove outer quotes if the entire text is enclosed in quotes (straight or elided)
|
473 |
+
if (text.startswith('"') and text.endswith('"')) or (text.startswith('«') and text.endswith('»')):
|
474 |
+
text = text[1:-1].strip()
|
475 |
+
|
476 |
+
# Step 7: Replace 100k with 100 000
|
477 |
text = re.sub(r'(\d+)[kкКK]', r'\1 000', text, flags=re.IGNORECASE)
|
478 |
|
479 |
+
# Step 8: Remove first sentence if it contains greetings and is less than 5 words
|
480 |
greeting_patterns = [
|
481 |
r"привет\b", r"здравствуй", r"добрый\s(день|вечер|утро)",
|
482 |
r"дорогой\b", r"уважаемый\b", r"дорогая\b", r"уважаемая\b",
|