4 Sentence Classification
This chapter covers:
- Handling variable-length input with recurrent neural networks (RNN)
- Working with RNNs and their variants (LSTMs and GRUs)
- Using common evaluation metrics for classification problems
- Developing and configuring a training pipeline using AllenNLP
- Building a language detector as a sentence classification task
In this chapter, we are going to study the task of sentence classification, where an NLP model receives a sentence and assigns some label to it. A spam filter is an application of sentence classification where it receives an email message and assigns whether it is a spam or not. If you want to classify news articles into different topics (business, politics, sports, etc.), it’s also a sentence classification task. Sentence classification is one of the simplest NLP tasks that have a wide range of applications including document classification, spam filtering, and sentiment analysis. Specifically, we are going to revisit the sentiment classifier we introduced in Chapter 2 and discuss its components in detail. At the end of this section, we are going to study another application of sentence classification—language detection.