Views
No views yet
O, B-/I-CITY, B-/I-COUNTRY, B-/I-ENTITY).AutoModelForTokenClassification). Turning the tagged spans into linked
(text → "<entity> <city> <country>") query strings is a separate, deterministic,
parameter-free step (a positional linker + a city→country gazetteer + country
canonicalization). An ONNX build for in-browser use (transformers.js) is at
Berk/multilingual-place-extractor-mdeberta-13lang-onnx.1import torch
2from transformers import AutoTokenizer, AutoModelForTokenClassification
3
4repo = "Berk/multilingual-place-extractor-mdeberta-13lang-tagger"
5tok = AutoTokenizer.from_pretrained(repo)
6model = AutoModelForTokenClassification.from_pretrained(repo).eval()
7
8text = "I booked Hotel Lungomare in Rimini then flew to Bologna"
9enc = tok(text, return_tensors="pt")
10with torch.no_grad():
11 pred = model(**enc).logits[0].argmax(-1)
12print([(tok.convert_ids_to_tokens([i])[0], model.config.id2label[p.item()])
13 for i, p in zip(enc["input_ids"][0], pred)])
14# -> Hotel/B-ENTITY Lung/I-ENTITY ... Rimini/B-CITY ... Bologna/B-CITY(city, country)(text → "<entity> <city> <country>") the repo
bundles the full ~1.03M-city gazetteer (GeoNames-derived):gazetteer/city_country_gazetteer.json — {"case_insensitive": {city → country}}gazetteer/city_country_multi.json — {ambiguous_city → [[country, population], …]} (pick the
candidate country that is named nearby in the text; else the highest-population one)gazetteer/country_lookup.json — {surface_form → English country} to canonicalize a tagged COUNTRY1import json
2gaz = json.load(open("gazetteer/city_country_gazetteer.json"))["case_insensitive"]
3clk = json.load(open("gazetteer/country_lookup.json"))
4norm = lambda s: " ".join(s.lower().split())
5
6# CITY span "Rimini" -> country
7print(gaz.get(norm("Rimini"))) # Italy
8# COUNTRY span "미국" (native script) -> canonical English
9print(clk.get(norm("미국"))) # United Statescascade.js in the companion ONNX repo
Berk/multilingual-place-extractor-mdeberta-13lang-onnx.| content | source | license |
|---|---|---|
| cities, countries, translations | GeoNames | CC BY 4.0 |
| airports, flight routes | OpenFlights | ODbL |
| points of interest / landmarks | Wikidata | CC0 |
| hotels, additional POIs | Foursquare Open Source Places | CC BY 4.0 |
| landmark seeds | Google Landmarks | CC BY 4.0 |
| query phrasing (generation only) | Qwen3-30B-A3B-Instruct-2507 | Apache-2.0 |
| base encoder | microsoft/mDeBERTa-v3-base | MIT |
| metric | value |
|---|---|
| typed span-F1 (token-level, 2,667-row entity-disjoint test) | 0.969 |
| full-system field_f1 (with the linker + gazetteer, 800-row clean gold) | 0.952 |