This repository contains the code for an NLP-based text classification model, which uses various Natural Language Processing techniques such as text preprocessing, stemming, and feature extraction to categorize textual data. The project employs the Naive Bayes algorithm for classification but can easily be extended to other classifiers.
-
Text Preprocessing:
- Clean the data by removing punctuation, special characters, and stopwords.
- Convert all text to lowercase for uniformity.
- Tokenize the text into individual words.
-
Stemming:
- Reduce words to their root form using NLTK's PorterStemmer to standardize different forms of the same word.
-
Bag of Words Model:
- Convert text into a numerical matrix representing word frequency.
-
Classification:
- Implemented using the Naive Bayes classifier to predict the category of text (spam or not spam in the case of a spam classifier).
The dataset used in this model consists of labeled text samples. You can use your own dataset for various use cases such as spam detection, sentiment analysis, or topic classification.
Make sure you have the following dependencies installed:
pip install nltk
pip install scikit-learn
pip install pandas
pip install numpy