sashtech commited on
Commit
92af867
·
verified ·
1 Parent(s): 8013380

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -62,6 +62,12 @@ def capitalize_sentences_and_nouns(text):
62
 
63
  return ' '.join(corrected_text)
64
 
 
 
 
 
 
 
65
  # Function to correct tense errors in a sentence
66
  def correct_tense_errors(text):
67
  doc = nlp(text)
@@ -216,6 +222,9 @@ def paraphrase_and_correct(text):
216
  # Capitalize sentences and nouns
217
  paraphrased_text = capitalize_sentences_and_nouns(cleaned_text)
218
 
 
 
 
219
  # Apply grammatical corrections
220
  paraphrased_text = correct_article_errors(paraphrased_text)
221
  paraphrased_text = correct_singular_plural_errors(paraphrased_text)
 
62
 
63
  return ' '.join(corrected_text)
64
 
65
+ # Function to force capitalization of the first letter of every sentence (NEW)
66
+ def force_first_letter_capital(text):
67
+ sentences = text.split(". ") # Split by period to get each sentence
68
+ capitalized_sentences = [sentence[0].capitalize() + sentence[1:] if sentence else "" for sentence in sentences]
69
+ return ". ".join(capitalized_sentences)
70
+
71
  # Function to correct tense errors in a sentence
72
  def correct_tense_errors(text):
73
  doc = nlp(text)
 
222
  # Capitalize sentences and nouns
223
  paraphrased_text = capitalize_sentences_and_nouns(cleaned_text)
224
 
225
+ # Ensure first letter of each sentence is capitalized
226
+ paraphrased_text = force_first_letter_capital(paraphrased_text)
227
+
228
  # Apply grammatical corrections
229
  paraphrased_text = correct_article_errors(paraphrased_text)
230
  paraphrased_text = correct_singular_plural_errors(paraphrased_text)