Spaces:
Runtime error
Runtime error
allenchienxxx
commited on
Commit
·
8db5c94
1
Parent(s):
9bbe331
Update analze.py
Browse files
analze.py
CHANGED
@@ -22,20 +22,6 @@ else:
|
|
22 |
# nltk.download('omw-1.4')
|
23 |
# nltk.download('wordnet')
|
24 |
|
25 |
-
def check_file_type(file):
|
26 |
-
file_extension = Path(file.name).suffix.lower()
|
27 |
-
if file_extension == '.eml' or file_extension == '.txt':
|
28 |
-
save_file(file)
|
29 |
-
return 'Extracted Features'
|
30 |
-
# return get_features('email files/' + file.filename)
|
31 |
-
else:
|
32 |
-
return "Please select .eml or .txt file."
|
33 |
-
|
34 |
-
def save_file(up_file):
|
35 |
-
with open(os.path.join('email files/', up_file.name), 'wb') as f:
|
36 |
-
f.write(up_file.getbuffer())
|
37 |
-
print("file save: "+up_file.name)
|
38 |
-
|
39 |
def text_feature(file):
|
40 |
text = get_text(file)
|
41 |
# print(text)
|
|
|
22 |
# nltk.download('omw-1.4')
|
23 |
# nltk.download('wordnet')
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
def text_feature(file):
|
26 |
text = get_text(file)
|
27 |
# print(text)
|