Skip to content

Commit

Permalink
Revise 21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
SamLau95 committed Apr 12, 2023
1 parent eced4ce commit 70f95ba
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions content/ch/21/fake_news_exploring.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6439,6 +6439,8 @@
" 'investig', 'antifa', 'joke', 'princ', 'homeless', 'cnn', 'the',\n",
"]\n",
"\n",
"# This function creates one new binary feature for each word in word_features,\n",
"# marking the presence of a word in an article.\n",
"def make_word_features(df, words=word_features):\n",
" features = { word: df['content'].str.contains(word) for word in words }\n",
" return pd.DataFrame(features)"
Expand Down

0 comments on commit 70f95ba

Please sign in to comment.