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. It receives an email message and assigns whether or not it is spam. If you want to classify news articles into different topics (business, politics, sports, and so on), it’s also a sentence-classification task. Sentence classification is one of the simplest NLP tasks that has 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.