Welcome to the BBC News Classification project! This Natural Language Processing (NLP) application classifies BBC news articles into various genres such as Sports, Politics, Entertainment, Business, and Technology. Utilizing powerful models like LSTM (Long Short-Term Memory) and GRU (Gated Recurrent Unit), our application achieves an impressive accuracy of ~94%. 🎯
In the BBC News Classification project, our goal is to accurately categorize BBC news articles into distinct genres using advanced NLP techniques. By training LSTM and GRU models on a labeled dataset, the application learns to identify patterns and features unique to each genre. Once trained, these models can predict the genre of new, unseen articles with high reliability. 📈
- Python 🐍
- Regular Expressions (re) 🔍
- NumPy ➗
- Pandas 📊
- Scikit-Learn 🧠
- TensorFlow 🤖
- Keras 🏗️
- HuggingFace Transformers 🔄
- Streamlit 🌐
Follow these steps to set up the project locally:
-
Install
virtualenv(if not already installed):pip install virtualenv
-
Create a Virtual Environment:
Create a new virtual environment. You can name it as you prefer; here, we'll use
bbc-news-classification-venv:virtualenv bbc-news-classification-venv
-
Activate the Virtual Environment:
-
Windows:
bbc-news-classification-venv\Scripts\activate
-
macOS/Linux:
source bbc-news-classification-venv/bin/activate
-
-
Clone the Repository:
Clone the repository into the directory where you created the virtual environment:
git clone https://github.com/alphatechlogics/Text-Classification.git
-
Navigate to the Project Directory:
cd BBCNewsClassifier -
Install Project Requirements:
Install all necessary dependencies using
pip:pip install -r requirements.txt
-
Run the Application:
Launch the Streamlit application:
streamlit run src/app.py
-
Deactivate the Virtual Environment:
After you're done, deactivate the environment:
deactivate
Once the application is up and running, access it through your web browser using the URL provided in the terminal (usually http://localhost:8501).
-
Enter Text: Input the content of a BBC news article into the text area provided.
-
Select Model: Choose between the LSTM or GRU model for classification. You can also select both to get an averaged prediction.
-
Submit: Click the Submit button to classify the article.
-
View Results:
- Predicted Category: Displays the genre the article belongs to.
- Prediction Score: Shows the confidence level of the prediction.
- Prediction Plot: Visualizes the prediction scores across different genres.
Demo of the BBC News Classification application in action.
