Dataset for Text Classification

Last Updated : 3 Jul, 2026

Text classification is one of the most common Natural Language Processing (NLP) tasks, where text documents are automatically assigned to predefined categories such as spam or ham, positive or negative sentiment, or news topics.

Components

To build accurate text classification models, machine learning algorithms require labelled datasets containing text samples and their corresponding class labels.

  1. Text Sample: These are the documents, sentences, emails, reviews, tweets, or articles that serve as the input for the classification model.
  2. Class Labels: Each text sample is assigned one or more labels representing its category, such as Positive, Negative, Sports, or Business.
  3. Training Set: The training set is used by the model to learn patterns and relationships between text and labels.
  4. Validation Set: The validation set helps tune model parameters and monitor performance during training.
  5. Test Set: The test set evaluates how well the trained model performs on previously unseen data.

Commonly Used Text Classification Datasets

1. IMDb Movie Reviews

  • It contains thousands of movie reviews collected from the IMDb platform, where each review is labeled as either positive or negative.
  • It is one of the most widely used benchmark datasets for binary sentiment classification.
  • Researchers use this dataset to train and evaluate models that classify customer opinions expressed in text.

2. AG News

  • This dataset consists of news articles categorized into four classes: World, Sports, Business, and Science/Technology.
  • It provides balanced data across multiple news categories, making it suitable for topic classification and document categorization tasks.

3. 20 Newsgroups

  • It contains thousands of posts collected from twenty online discussion groups covering topics such as politics, religion, sports, science, and technology.
  • Due to its diverse vocabulary and multiple categories, it is widely used for multi-class text classification and document clustering.

4. Reuters-21578

  • It contains Reuters news articles labeled with one or more business-related topics.
  • Since a single article may belong to multiple categories, the dataset is commonly used for both multi-class and multi-label text classification research.

5. Spam Email Detection Dataset

  • It contain email messages labeled as Spam or Ham (Not Spam).
  • These datasets help train machine learning models that automatically identify unwanted emails based on their content, subject, and other textual features.

6. Twitter Sentiment Analysis Dataset

  • It consist of tweets labeled as positive, negative, or neutral.
  • Since tweets are short and often contain hashtags, abbreviations, and emojis, these datasets are widely used for building sentiment analysis models for social media.

7. Yelp Reviews

  • It contains customer reviews and ratings for restaurants, hotels, and other businesses listed on Yelp.
  • It is commonly used to classify customer opinions, predict ratings, and analyze user feedback.

8. Amazon Reviews

  • It contains product reviews and ratings submitted by customers across various product categories.
  • It is widely used to classify product sentiment, analyze customer feedback, and build recommendation systems.

9. Stack Overflow Questions

  • Contains programming-related questions tagged with different technologies, programming languages, and frameworks.
  • It helps train models that automatically categorize technical questions based on their content.

10. BBC News Classification Dataset

  • Contains news articles categorized into five classes: Business, Entertainment, Politics, Sport, and Technology.
  • It is a relatively small but clean dataset that is frequently used for learning and benchmarking text classification algorithms.

Applications

  1. Sentiment Analysis: Train models to classify reviews, feedback, and social media posts based on sentiment.
  2. Spam Detection: Build email filtering systems that identify spam and legitimate messages.
  3. News Categorization: Automatically organize news articles into predefined topics such as business, politics, and sports.
  4. Intent Classification: Enable chatbots and virtual assistants to understand user intent from text queries.
  5. Content Moderation: Detect abusive, offensive, or inappropriate content on online platforms.
  6. Document Organization: Automatically classify reports, research papers, and business documents into relevant categories.
Comment

Explore