Spaces:
Runtime error
Runtime error
Commit
·
de68813
1
Parent(s):
e5238cb
Update app.py
Browse files
app.py
CHANGED
@@ -35,22 +35,15 @@ model2 = AutoModelForSequenceClassification.from_pretrained(model2_path)
|
|
35 |
|
36 |
def preprocess(text):
|
37 |
new_text = []
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
t = 'http' if t.startswith('http') else t
|
48 |
-
|
49 |
-
new_text.append(t)
|
50 |
-
|
51 |
-
# Join the preprocessed text
|
52 |
-
|
53 |
-
return " ".join(new_text)
|
54 |
|
55 |
|
56 |
|
|
|
35 |
|
36 |
def preprocess(text):
|
37 |
new_text = []
|
38 |
+
# Replace user mentions with '@user'
|
39 |
+
for t in text.split(" "):
|
40 |
+
t = '@user' if t.startswith('@') and len(t) > 1 else t
|
41 |
+
# Replace links with 'http'
|
42 |
+
t = 'http' if t.startswith('http') else t
|
43 |
+
new_text.append(t)
|
44 |
+
# Join the preprocessed text
|
45 |
+
|
46 |
+
return " ".join(new_text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
|
49 |
|