fruitpicker01 commited on
Commit
007dec9
·
verified ·
1 Parent(s): de3d58f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
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: Replace 100k with 100 000
 
 
 
 
473
  text = re.sub(r'(\d+)[kкКK]', r'\1 000', text, flags=re.IGNORECASE)
474
 
475
- # Step 7: Remove first sentence if it contains greetings and is less than 5 words
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",