Views
No views yet
Scope: this model does not predict coordinates. It outputs structured fields; pass them to a geocoder (Nominatim / Photon / Pelias) for lat-long.
Opposite Chicken Republic after Mobil filling station, Lekki Phase 11{
2 "landmarks": [
3 {"name": "Chicken Republic", "relation": "opposite", "qualifier": null},
4 {"name": "Mobil Filling Station", "relation": "after", "qualifier": null}
5 ],
6 "area": "Lekki Phase 1",
7 "city": "Lagos",
8 "state": "Lagos",
9 "country": "Nigeria"
10}| field | type | notes |
|---|---|---|
landmarks | list of objects | each has name, relation, qualifier |
landmarks[].name | string | canonical landmark name |
landmarks[].relation | string | null | opposite, beside, behind, before, after, near, under, inside, at |
landmarks[].qualifier | string | null | e.g. "blue gate", "second gate", "the junction" |
area | string | null | neighbourhood / district |
city | string | null | inferred from area |
state | string | null | inferred from area |
country | string | always "Nigeria" for this model |
1from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
2import json
3
4mid = "sobowalebukola/naija-address-normalizer"
5tok = AutoTokenizer.from_pretrained(mid)
6model = AutoModelForSeq2SeqLM.from_pretrained(mid)
7
8PREFIX = "normalize nigerian address to json: "
9text = "blue gate beside zenith bank, close to ajah roundabout"
10enc = tok(PREFIX + text, return_tensors="pt")
11out = model.generate(**enc, max_length=192, num_beams=4)
12print(json.loads(tok.decode(out[0], skip_special_tokens=True)))opp, b/4), shortened names (GTB), qualifiers (blue gate, second gate),
light Pidgin connectors, casing noise, dropped commas, and typos. Landmark/area
pools cover Lagos heavily plus Abuja, Port Harcourt, Ibadan, Kano, Enugu and more.under is rare in the data (bridges only), so expect weaker performance there.1pip install -r requirements.txt
2python generate_dataset.py --n 8000 --out data
3python train.py --model google/flan-t5-base --epochs 5 --bs 16 --fp16
4python evaluate.py --model checkpoints --data data