# π£οΈ 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
βββ β¦