Skip to content

Instantly share code, notes, and snippets.

@yogeshnile
Created July 15, 2020 08:13
Show Gist options
  • Save yogeshnile/9c89cd50876c50f88b5bb56ac8f69534 to your computer and use it in GitHub Desktop.
Save yogeshnile/9c89cd50876c50f88b5bb56ac8f69534 to your computer and use it in GitHub Desktop.
#Save corpus for use in deployment
file_name = "corpus.pkl"
pickle.dump(corpus, open(file_name, 'wb'))
#Creating the Bag of Words model
from sklearn.feature_extraction.text import CountVectorizer
cv = CountVectorizer(max_features=2500)
X = cv.fit_transform(corpus).toarray()
#Extracting dependent variable from the dataset
y = pd.get_dummies(sms['label'])
y = y.iloc[:, 1].values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment