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))