# πͺπΉ Amharic NER System
**Named Entity Recognition for Amharic** using XLM-RoBERTa and semi-supervised learning (self-training with pseudo-labeling).
---
## π Project Structure
```
NER/
βββ configs/
β βββ config.py # Hyperparameters & label definitions
βββ data/
β βββ data_loader.py # CoNLL/text loaders & NERDataset
β βββ labeled/
β β βββ sample.conll # Sample labeled data (BIO format)
β βββ unlabeled/
β βββ sample.txt # Sample unlabeled Amharic sentences
βββ preprocessing/
β βββ text_normalizer.py # Amharic-specific text cleaning
β βββ tokenization.py # XLM-R tokenizer + label alignment
βββ models/
β βββ ner_model.py # XLM-RoBERTa token classification
βββ training/
β βββ trainer.py # Supervised training loop
β βββ semi_supervised.py # Self-training pipeline
βββ evaluation/
β βββ metrics.py # Entity-level P/R/F1 (seqeval)
βββ inference/
β βββ predictor.py # Single-text NER prediction
βββ utils/
β βββ helpers.py # Seed, device, save/load utilities
βββ templates/
β βββ index.html # Web UI template
βββ app.py # FastAPI web server
βββ main.py # CLI entry point
βββ requirements.txt # Python dependencies
βββ README.md # This file
```
---
## π Setup
### 1. Install dependencies
```bash
pip install -r requirements.txt
```
### 2. Prepare data
- **Labeled data** goes in `data/labeled/` in CoNLL format (one token + label per line, blank lines between sentences):
```
α α α B-PER
α α²α΅ B-LOC
α α α£ I-LOC
αα΅α₯ O
ααα«α O
α’ O
```
- **Unlabeled data** goes in `data/unlabeled/` as plain text (one sentence per line).
---
## ποΈ Training
### Supervised Training
Train on labeled data only:
```bash
python main.py train --data data/labeled/sample.conll --epochs 5
```
Options:
- `--epochs N` β number of training epochs (default: 5)
- `--lr 2e-5` β learning rate
- `--ba β¦