# 🗣️ Amharic Social Media Hate Speech Analyzer
A web-based NLP tool for detecting **hate speech**, **offensive**, and **normal** content in **Amharic** text collected from public Telegram channels and groups. Built for educational and research purposes, this project demonstrates practical applications of Natural Language Processing for low-resource languages.
## 🚀 Features
* **🔍 Web Interface**
Simple and clean web form where users input Telegram URLs to view categorized analysis results.
* **🧹 Amharic Text Preprocessing**
Custom normalization for Amharic characters, removal of URLs, mentions, hashtags, emojis, and a comprehensive stopword list.
* **✂️ Sentence-Level Tokenization**
Breaks down long messages and comments into individual sentences for more detailed classification.
* **🧠 Machine Learning Model**
Logistic Regression classifier using TF-IDF features, trained on `uhhlt/amharichatespeechranlp` dataset.
* **📡 Telegram Scraper (Telethon)**
Asynchronously fetches:
* Comments from a specific Telegram post.
* Messages (and their comments) from channels or groups.
* Automatically detects message type (channel/group) and supports a custom message limit (default: 1000).
* **📊 Result Summary**
Shows:
* Number of messages/comments scraped
* Total sentences analyzed
* Category breakdown: hate, offensive, and normal
* Example sentences for each category
* **🧩 Modular Design**
Code is organized for readability and reusability using separate modules.
---
## 📁 Project Structure
```plaintext
amharic_hate_speech_analyzer/
├── config.py # Configuration settings (API keys, model paths, label mapping)
├── amharic_preprocessing.py # Amharic text cleaning, normalization, and tokenization
├── model_trainer.py # Model training and saving script
├── telegram_scraper.py # Telegram data fetching logic (messages + comments)
├── server.py # Main Flask web application
├── …