Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -68,10 +68,17 @@ def capitalize_sentences_and_nouns(text):
|
|
68 |
return ' '.join(corrected_text)
|
69 |
|
70 |
# Function to force capitalization of the first letter of every sentence
|
|
|
71 |
def force_first_letter_capital(text):
|
72 |
-
sentences =
|
73 |
-
capitalized_sentences = [
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
# Function to correct tense errors in a sentence
|
77 |
def correct_tense_errors(text):
|
|
|
68 |
return ' '.join(corrected_text)
|
69 |
|
70 |
# Function to force capitalization of the first letter of every sentence
|
71 |
+
# Function to force capitalization of the first letter of every sentence and add missing full stops
|
72 |
def force_first_letter_capital(text):
|
73 |
+
sentences = re.split(r'(?<=[.!?])\s+', text) # Split on sentence-ending punctuation followed by space
|
74 |
+
capitalized_sentences = []
|
75 |
+
for sentence in sentences:
|
76 |
+
sentence = sentence.strip()
|
77 |
+
if sentence: # Ensure the sentence is not empty
|
78 |
+
if sentence[-1] not in '.!?': # Add missing full stop if needed
|
79 |
+
sentence += '.'
|
80 |
+
capitalized_sentences.append(sentence[0].capitalize() + sentence[1:])
|
81 |
+
return ' '.join(capitalized_sentences)
|
82 |
|
83 |
# Function to correct tense errors in a sentence
|
84 |
def correct_tense_errors(text):
|