Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ nltk.download('stopwords')
|
|
15 |
|
16 |
ps = PorterStemmer()
|
17 |
|
18 |
-
def
|
19 |
corpus = []
|
20 |
text = re.sub('[^a-zA-Z0-9$£€¥%]',' ',text)
|
21 |
text = text.lower()
|
@@ -37,6 +37,7 @@ def classify(text,choice):
|
|
37 |
features = vectorizer.transform(corpus).toarray()
|
38 |
prediction = nb_classifier.predict(features)
|
39 |
elif(choice == 2):
|
|
|
40 |
features = tfidf_vectorizer.transform(corpus).toarray()
|
41 |
prediction = random_forest.predict(features)
|
42 |
if(prediction == 1):
|
|
|
15 |
|
16 |
ps = PorterStemmer()
|
17 |
|
18 |
+
def preprocess_for_bow_and_tfidf(text):
|
19 |
corpus = []
|
20 |
text = re.sub('[^a-zA-Z0-9$£€¥%]',' ',text)
|
21 |
text = text.lower()
|
|
|
37 |
features = vectorizer.transform(corpus).toarray()
|
38 |
prediction = nb_classifier.predict(features)
|
39 |
elif(choice == 2):
|
40 |
+
corpus = preprocess_for_bow_and_tfidf
|
41 |
features = tfidf_vectorizer.transform(corpus).toarray()
|
42 |
prediction = random_forest.predict(features)
|
43 |
if(prediction == 1):
|