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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started