Commit
·
175a254
1
Parent(s):
0652585
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,8 @@ from transformers import RobertaTokenizer, RobertaForSequenceClassification
|
|
| 4 |
import nltk
|
| 5 |
from nltk.corpus import stopwords
|
| 6 |
import re
|
|
|
|
|
|
|
| 7 |
nltk.download('stopwords')
|
| 8 |
nltk.download('punkt')
|
| 9 |
stop_words = set(stopwords.words('english'))
|
|
@@ -34,6 +36,7 @@ def preprocess_query(query):
|
|
| 34 |
query = str(query).lower()
|
| 35 |
query = query.strip()
|
| 36 |
query = remove_stop_words(query)
|
|
|
|
| 37 |
return query
|
| 38 |
|
| 39 |
def predict_aspects(sentence, threshold):
|
|
|
|
| 4 |
import nltk
|
| 5 |
from nltk.corpus import stopwords
|
| 6 |
import re
|
| 7 |
+
import string
|
| 8 |
+
|
| 9 |
nltk.download('stopwords')
|
| 10 |
nltk.download('punkt')
|
| 11 |
stop_words = set(stopwords.words('english'))
|
|
|
|
| 36 |
query = str(query).lower()
|
| 37 |
query = query.strip()
|
| 38 |
query = remove_stop_words(query)
|
| 39 |
+
query=query.translate(str.maketrans("", "", string.punctuation))
|
| 40 |
return query
|
| 41 |
|
| 42 |
def predict_aspects(sentence, threshold):
|