Question: Hi! I'm working on an exercise about Spam Filters using Naive Bayes. Got the data from TREC06 Public Spam Corpus. However, I'm having trouble starting.
Hi! I'm working on an exercise about Spam Filters using Naive Bayes.
Got the data from TREC06 Public Spam Corpus. However, I'm having trouble starting.
Basically there is a file that contains directory of emails in another folder. Format is as follows:
ham ../data/000/000 spam ../data/000/001 spam ../data/000/002 ham ../data/000/003 spam ../data/000/004 ham ../data/000/005 ham ../data/000/006 spam ../data/000/007
This file basically says that in the folder data > 000 > 000 is ham. Then data > 000 > 001 is spam, and so forth.
The folder named data has all the emails (1 email = 1 file).
Wondering how I can create a dataset that has all the email body in one? Kindly help me on the python code please.
| Index | Classification | Email content |
| 000/001 | Ham | This is the email body |
| 000/002 | Spam | This is another. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
