Logo Lanfrica

AbeloByte/NER_Amharic

Domain:

natural language processing

Record type:

software
Creator:
Abe
Host:
# πŸ‡ͺπŸ‡Ή 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 …

Languages