# π Amharic NER Pipeline for EthioMart
This repository contains tools and scripts to preprocess Amharic Telegram text data, perform Named Entity Recognition (NER) using a fine-tuned transformer model, and extract vendor analytics for micro-lending evaluation.
---
## β¨ Features
- **β
Text Cleaning & Normalization**
- Removes emojis, symbols, links, and redundant punctuation.
- Normalizes Amharic-specific characters and spacing.
- **π Tokenization**
- Uses `XLM-RoBERTa` tokenizer for multilingual support.
- Token-level formatting for CoNLL-style entity tagging.
- **π·οΈ NER Annotation Support**
- Manual annotation via CoNLL format.
- Supports entity labels:
- `B-PRICE`, `I-PRICE`
- `B-PRODUCT`, `I-PRODUCT`
- `B-LOC`, `I-LOC`
- `O` for non-entity tokens
- **π§ Model Fine-tuning**
- Fine-tunes `xlm-roberta-base` on Amharic NER data.
- Built using Hugging Face Transformers.
- **π Vendor Analytics & Scorecard**
- Extracts product/price entities from vendor posts.
- Computes posting frequency, engagement metrics, and Lending Score.
---
## ποΈ Project Structure
``` yaml
/
βββ scripts/
β βββ preprocess.py # Cleaning and tokenization
β βββ ner_utils.py # Entity extraction utilities
β βββ vendor_metrics.py # Scorecard computation
β βββ telegram_scraper.py # Telegram data scraping
β
βββ data/
β βββ raw/ # Raw Telegram data
β βββ processed/ # Cleaned + enriched data
β βββ labeled_conll/ # CoNLL annotated data
β
βββ models/
β βββ trained_models/ # Fine-tuned XLM-RoBERTa model
β
βββ notebooks/
β βββ 01_preprocessing.ipynb
β βββ 03_fine_tuning.ipynb
β βββ 05_lime_and_shap.ipynb
β βββ 08_scorecard_analysis.ipynb
β
βββ interpretability/
β βββ difficult_cases.md # Model errors & discussion
β
βββ outputs/
β βββ enriched_data.csv # Product/price enriched records
β
βββ tests/
β βββ test_preprocess.py
β βββ test_dummy.py
β
βββ requirements.txt
βββ README.md
```
---
## π Getting Started
### π¦ Installation
```bash
git clone
github.com
cd ethiomar β¦