Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions NLP for Text Classification (Jupyter Notebook).ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,9 @@
"source": [
"from nltk.corpus import stopwords\n",
"\n",
"# remove stop words from text messages\n",
"# remove stop words from text messages,and passed result into a list\n",
"\n",
"stop_words = set(stopwords.words('english'))\n",
"stop_words = list(set(stopwords.words('english')))\n",
"\n",
"processed = processed.apply(lambda x: ' '.join(\n",
" term for term in x.split() if term not in stop_words))"
Expand Down Expand Up @@ -461,7 +461,7 @@
"features = find_features(processed[0])\n",
"for key, value in features.items():\n",
" if value == True:\n",
" print key"
" print (key)"
]
},
{
Expand Down Expand Up @@ -546,7 +546,7 @@
"# train the model on the training data\n",
"model.train(training)\n",
"\n",
"# and test on the testing dataset!\n",
"# and test on the testing dataset!(warning, this might take some time,so go make yourself a good meal, you desereve it)\n",
"accuracy = nltk.classify.accuracy(model, testing)*100\n",
"print(\"SVC Accuracy: {}\".format(accuracy))"
]
Expand Down