Spaces:
Runtime error
Runtime error
Commit ·
6b28c2c
1
Parent(s): 0897d96
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,10 @@ from topics_extraction import classify
|
|
| 7 |
from PyDictionary import PyDictionary
|
| 8 |
dictionary=PyDictionary()
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
def get_output(event_info):
|
| 12 |
if len(event_info.split(' '))>=20:
|
|
@@ -22,7 +26,6 @@ def get_output(event_info):
|
|
| 22 |
flattened_list_v,flattened_list_n = lam_list(flattened_list)
|
| 23 |
flattened_list = flattened_list_v + flattened_list_n
|
| 24 |
|
| 25 |
-
print(flattened_list,'///')
|
| 26 |
|
| 27 |
tags_list_check_v,tags_list_check_n = lam_list(tags_list)
|
| 28 |
|
|
@@ -36,8 +39,12 @@ def get_output(event_info):
|
|
| 36 |
others = list(others_v.keys()) + list(others_n.keys())
|
| 37 |
|
| 38 |
others = list(set(others))
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
else:
|
| 43 |
others = []
|
|
|
|
| 7 |
from PyDictionary import PyDictionary
|
| 8 |
dictionary=PyDictionary()
|
| 9 |
|
| 10 |
+
from nltk.stem import PorterStemmer
|
| 11 |
+
stemmer = PorterStemmer()
|
| 12 |
+
|
| 13 |
+
|
| 14 |
|
| 15 |
def get_output(event_info):
|
| 16 |
if len(event_info.split(' '))>=20:
|
|
|
|
| 26 |
flattened_list_v,flattened_list_n = lam_list(flattened_list)
|
| 27 |
flattened_list = flattened_list_v + flattened_list_n
|
| 28 |
|
|
|
|
| 29 |
|
| 30 |
tags_list_check_v,tags_list_check_n = lam_list(tags_list)
|
| 31 |
|
|
|
|
| 39 |
others = list(others_v.keys()) + list(others_n.keys())
|
| 40 |
|
| 41 |
others = list(set(others))
|
| 42 |
+
|
| 43 |
+
list1_stemmed = {stemmer.stem(word) for word in list(set(flattened_list))}
|
| 44 |
+
final_list_stemmed = [(word, stemmer.stem(word)) for word in others]
|
| 45 |
+
|
| 46 |
+
others = [word for word, stemmed in final_list_stemmed if stemmed not in list1_stemmed]
|
| 47 |
+
|
| 48 |
|
| 49 |
else:
|
| 50 |
others = []
|