Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ import spacy
|
|
| 5 |
import subprocess
|
| 6 |
import nltk
|
| 7 |
from nltk.corpus import wordnet
|
| 8 |
-
import
|
| 9 |
from pattern.en import conjugate, lemma, pluralize, singularize
|
| 10 |
|
| 11 |
# Initialize the English text classification pipeline for AI detection
|
|
@@ -101,12 +101,11 @@ def correct_article_errors(text):
|
|
| 101 |
corrected_text.append(token.text)
|
| 102 |
return ' '.join(corrected_text)
|
| 103 |
|
| 104 |
-
# Function to correct overall grammar using
|
| 105 |
def correct_grammar(text):
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
return corrected_text
|
| 110 |
|
| 111 |
# Paraphrasing function using SpaCy and NLTK (Humanifier)
|
| 112 |
def paraphrase_with_spacy_nltk(text):
|
|
@@ -151,7 +150,7 @@ def paraphrase_and_correct(text):
|
|
| 151 |
# Step 3: Correct tense errors
|
| 152 |
corrected_text = correct_tense_errors(corrected_text)
|
| 153 |
|
| 154 |
-
# Step 4: Correct overall grammar using
|
| 155 |
final_text = correct_grammar(corrected_text)
|
| 156 |
|
| 157 |
return final_text
|
|
|
|
| 5 |
import subprocess
|
| 6 |
import nltk
|
| 7 |
from nltk.corpus import wordnet
|
| 8 |
+
from gramma import GrammaticalErrorFinder
|
| 9 |
from pattern.en import conjugate, lemma, pluralize, singularize
|
| 10 |
|
| 11 |
# Initialize the English text classification pipeline for AI detection
|
|
|
|
| 101 |
corrected_text.append(token.text)
|
| 102 |
return ' '.join(corrected_text)
|
| 103 |
|
| 104 |
+
# Function to correct overall grammar using gramma
|
| 105 |
def correct_grammar(text):
|
| 106 |
+
checker = GrammaticalErrorFinder()
|
| 107 |
+
corrections = checker.correct_text(text)
|
| 108 |
+
return corrections
|
|
|
|
| 109 |
|
| 110 |
# Paraphrasing function using SpaCy and NLTK (Humanifier)
|
| 111 |
def paraphrase_with_spacy_nltk(text):
|
|
|
|
| 150 |
# Step 3: Correct tense errors
|
| 151 |
corrected_text = correct_tense_errors(corrected_text)
|
| 152 |
|
| 153 |
+
# Step 4: Correct overall grammar using gramma
|
| 154 |
final_text = correct_grammar(corrected_text)
|
| 155 |
|
| 156 |
return final_text
|