Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,7 @@ import string
|
|
| 13 |
# Ensure necessary NLTK data is downloaded
|
| 14 |
def download_nltk_resources():
|
| 15 |
try:
|
| 16 |
-
nltk.download('punkt') # Tokenizer
|
| 17 |
nltk.download('stopwords') # Stop words
|
| 18 |
nltk.download('averaged_perceptron_tagger') # POS tagger
|
| 19 |
nltk.download('wordnet') # WordNet
|
|
@@ -205,13 +205,10 @@ def correct_spelling(text):
|
|
| 205 |
corrected_words = []
|
| 206 |
for word in words:
|
| 207 |
corrected_word = spell.correction(word)
|
| 208 |
-
|
| 209 |
-
corrected_words.append(corrected_word)
|
| 210 |
-
else:
|
| 211 |
-
corrected_words.append(word)
|
| 212 |
return ' '.join(corrected_words)
|
| 213 |
|
| 214 |
-
# Main function for paraphrasing and grammar correction
|
| 215 |
def paraphrase_and_correct(text):
|
| 216 |
cleaned_text = remove_redundant_words(text)
|
| 217 |
cleaned_text = fix_punctuation_spacing(cleaned_text)
|
|
|
|
| 13 |
# Ensure necessary NLTK data is downloaded
|
| 14 |
def download_nltk_resources():
|
| 15 |
try:
|
| 16 |
+
nltk.download('punkt') # Tokenizer for English text
|
| 17 |
nltk.download('stopwords') # Stop words
|
| 18 |
nltk.download('averaged_perceptron_tagger') # POS tagger
|
| 19 |
nltk.download('wordnet') # WordNet
|
|
|
|
| 205 |
corrected_words = []
|
| 206 |
for word in words:
|
| 207 |
corrected_word = spell.correction(word)
|
| 208 |
+
corrected_words.append(corrected_word)
|
|
|
|
|
|
|
|
|
|
| 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)
|
| 214 |
cleaned_text = fix_punctuation_spacing(cleaned_text)
|