Detection of Offensive Language in Yoruba Text using ML (TF-IDF, Logistic Regression)
# Offensive Yoruba Language Detection App
This repository contains a machine learning-based application for detecting offensive language in yoruba text. The app is built using either **Streamlit** or **Flask** and leverages a **Logistic Regression** model trained on a dataset of tweets. The model uses **TF-IDF Vectorization** for text preprocessing and classification.
---
## Table of Contents
1. Project Overview
2. Features
3. Installation
4. Usage
5. Model Development
6. File Structure
7. Contributing
8. License
---
## Project Overview
The goal of this project is to detect if a lanuange in yoruba is based off of text inputs. The app takes a sentence as input and predicts whether it contains offensive language, hate speech, or is normal. The model is trained on a dataset of tweets and uses **TF-IDF Vectorization** for feature extraction and **Logistic Regression** for classification.
---
## Features
- **Text Input**: Users can input a sentence to check for offensive language.
- **Real-Time Prediction**: The app provides instant predictions using a pre-trained machine learning model.
- **Clean and Preprocess Text**: The app cleans and preprocesses the input text (e.g., removes emojis, URLs, and special characters) before making predictions.
- **Streamlit and Flask Support**: The app can be deployed using either Streamlit or Flask.
---
## Installation
### Prerequisites
- Python 3.7 or higher
- pip (Python package manager)
### Steps
1. **Clone the Repository**:
```bash
git clone
github.com
cd Yoruba-Offensive-Language-Detection-Model
```
2. **Create a Virtual Environment** (Optional but Recommended):
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```
3. **Install Dependencies**:
```bash
pip install -r requirements.txt
```
4. **Download NLTK Data**:
The app uses NLTK for text preprocessing. Download the required NLTK data by running:
```b …