“A bag-of-words is all you need,” some NLPers have decreed.
The bag-of-words language model is a simple-yet-powerful tool to have up your sleeve when working on natural language processing (NLP). The model has many, many use cases including:
- determining topics in a song
- filtering spam from your inbox
- finding out if a tweet has positive or negative sentiment
- creating word clouds
In the code editor, we’ve created a spam filter using bag-of-words. Test it out!
Replace the text in
test_text with the text from a marketing email you’ve received and run the code. Was the result what you expected?