Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -199,15 +199,18 @@ def ensure_subject_verb_agreement(text):
|
|
| 199 |
corrected_text.append(token.text)
|
| 200 |
return ' '.join(corrected_text)
|
| 201 |
|
|
|
|
| 202 |
# Function to correct spelling errors
|
| 203 |
def correct_spelling(text):
|
| 204 |
words = text.split()
|
| 205 |
corrected_words = []
|
| 206 |
for word in words:
|
| 207 |
corrected_word = spell.correction(word)
|
| 208 |
-
|
|
|
|
| 209 |
return ' '.join(corrected_words)
|
| 210 |
|
|
|
|
| 211 |
# Main processing function for paraphrasing and grammar correction
|
| 212 |
def paraphrase_and_correct(text):
|
| 213 |
cleaned_text = remove_redundant_words(text)
|
|
|
|
| 199 |
corrected_text.append(token.text)
|
| 200 |
return ' '.join(corrected_text)
|
| 201 |
|
| 202 |
+
# Function to correct spelling errors
|
| 203 |
# Function to correct spelling errors
|
| 204 |
def correct_spelling(text):
|
| 205 |
words = text.split()
|
| 206 |
corrected_words = []
|
| 207 |
for word in words:
|
| 208 |
corrected_word = spell.correction(word)
|
| 209 |
+
# If correction returns None, keep the original word
|
| 210 |
+
corrected_words.append(corrected_word if corrected_word is not None else word)
|
| 211 |
return ' '.join(corrected_words)
|
| 212 |
|
| 213 |
+
|
| 214 |
# Main processing function for paraphrasing and grammar correction
|
| 215 |
def paraphrase_and_correct(text):
|
| 216 |
cleaned_text = remove_redundant_words(text)
|