From a854657195ad13e1ffc0c30c6c5e0620fe2f9613 Mon Sep 17 00:00:00 2001 From: ShreyaShukla03 <93048997+ShreyaShukla03@users.noreply.github.com> Date: Thu, 13 Oct 2022 21:18:55 +0530 Subject: [PATCH] Email Spam Filtering Project Category python --- Email Spam Filtering Project | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Email Spam Filtering Project diff --git a/Email Spam Filtering Project b/Email Spam Filtering Project new file mode 100644 index 0000000..8ba0001 --- /dev/null +++ b/Email Spam Filtering Project @@ -0,0 +1,18 @@ +import pandas as pd +from sklearn.model_selection import train_test_split +from sklearn.feature_extraction.text import CountVectorizer +from sklearn import svm + +spam = pd.read_csv('C:\\Users\\nethm\\Downloads\\spam.csv') +z = spam['EmailText'] +y = spam["Label"] +z_train, z_test,y_train, y_test = train_test_split(z,y,test_size = 0.2) + +cv = CountVectorizer() +features = cv.fit_transform(z_train) + +model = svm.SVC() +model.fit(features,y_train) + +features_test = cv.transform(z_test) +print(model.score(features_test,y_test))