sashtech commited on
Commit
f41db2d
·
verified ·
1 Parent(s): 9edb1da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -13
app.py CHANGED
@@ -8,7 +8,6 @@ from nltk.corpus import wordnet
8
  from nltk.corpus import stopwords
9
  from nltk.tokenize import word_tokenize
10
  from spellchecker import SpellChecker
11
- from textblob import TextBlob # Importing TextBlob
12
  import re
13
  import string
14
  import random
@@ -210,13 +209,6 @@ def correct_spelling(text):
210
  return ' '.join(corrected_words)
211
 
212
 
213
- # Function to correct grammar using TextBlob
214
- def textblob_grammar_correction(text):
215
- blob = TextBlob(text)
216
- corrected_text = str(blob.correct())
217
- return corrected_text
218
-
219
-
220
  def paraphrase_and_correct(text):
221
  paragraphs = text.split("\n\n") # Split by paragraphs
222
 
@@ -233,10 +225,6 @@ def paraphrase_and_correct(text):
233
  paraphrased_text = correct_tense_errors(paraphrased_text)
234
  paraphrased_text = ensure_subject_verb_agreement(paraphrased_text)
235
  paraphrased_text = fix_punctuation_spacing(paraphrased_text)
236
-
237
- # Apply TextBlob grammar correction
238
- paraphrased_text = textblob_grammar_correction(paraphrased_text)
239
-
240
  processed_paragraphs.append(paraphrased_text)
241
 
242
  return "\n\n".join(processed_paragraphs) # Reassemble the text with paragraphs
@@ -259,4 +247,4 @@ with gr.Blocks() as demo:
259
 
260
  button2.click(fn=paraphrase_and_correct, inputs=t2, outputs=result2)
261
 
262
- demo.launch(share=True)
 
8
  from nltk.corpus import stopwords
9
  from nltk.tokenize import word_tokenize
10
  from spellchecker import SpellChecker
 
11
  import re
12
  import string
13
  import random
 
209
  return ' '.join(corrected_words)
210
 
211
 
 
 
 
 
 
 
 
212
  def paraphrase_and_correct(text):
213
  paragraphs = text.split("\n\n") # Split by paragraphs
214
 
 
225
  paraphrased_text = correct_tense_errors(paraphrased_text)
226
  paraphrased_text = ensure_subject_verb_agreement(paraphrased_text)
227
  paraphrased_text = fix_punctuation_spacing(paraphrased_text)
 
 
 
 
228
  processed_paragraphs.append(paraphrased_text)
229
 
230
  return "\n\n".join(processed_paragraphs) # Reassemble the text with paragraphs
 
247
 
248
  button2.click(fn=paraphrase_and_correct, inputs=t2, outputs=result2)
249
 
250
+ demo.launch(share=True)