Views
No views yet
1from gliner import GLiNER
2
3# Load the model
4model = GLiNER.from_pretrained("Lahad/gliner_wolof_NER")
5
6# Define entity types
7labels = ["PER", "ORG", "LOC", "DATE"]
8
9# Predict entities
10text = "Ousmane Sonko jàngae na ci Daaray Cheikh Anta Diop ci Dakar."
11entities = model.predict_entities(text, labels, threshold=0.5)
12
13for entity in entities:
14 print(f"{entity['text']} => {entity['label']} (score: {entity['score']:.2f})")
15
16 → Ousmane Sonko => PER (score: 0.95)
17 → Daaray Cheikh Anta Diop => ORG (score: 0.89)
18 → Dakar => LOC (score: 0.97)wol).| Entity Type | Precision | Recall | F1-Score | Support |
|---|---|---|---|---|
| DATE | 30.77% | 22.86% | 26.23% | 70 |
| LOC | 76.75% | 84.95% | 80.65% | 206 |
| ORG | 41.89% | 56.36% | 48.06% | 55 |
| PER | 53.02% | 70.69% | 60.59% | 174 |
| GLOBAL | 58.87% | 68.32% | 63.24% | 505 |