fruitpicker01 commited on
Commit
8fae977
·
verified ·
1 Parent(s): da97489

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -509,6 +509,25 @@ def correct_dash_usage(text):
509
  # Join the sentences back
510
  text = ' '.join(sentences)
511
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
512
  return text
513
 
514
 
 
509
  # Join the sentences back
510
  text = ' '.join(sentences)
511
 
512
+ def restore_yo(text):
513
+ morph = pymorphy2.MorphAnalyzer()
514
+ words = text.split()
515
+ restored_words = []
516
+
517
+ for word in words:
518
+ parsed = morph.parse(word)[0]
519
+ restored_word = parsed.word
520
+
521
+ # Сохраняем оригинальный регистр первой буквы
522
+ if word and word[0].isupper():
523
+ restored_word = restored_word.capitalize()
524
+
525
+ restored_words.append(restored_word)
526
+
527
+ return ' '.join(restored_words)
528
+
529
+ text = restore_yo(text)
530
+
531
  return text
532
 
533