Views
No views yet
*-13lang / *-onnx / *-tagger repos.{type, text, city, region, country, query}:
type includes REGION; cities are enriched with their admin-1 region (Florence→Tuscany);
query is the flat "<entity> <city> <country>" string (unchanged, backward-compatible).compose_structural_query(..., coherence_vote=True))
but is off by default pending further validation.1import json
2from infer_place_extractor import PlaceExtractor # scripts/
3
4ext = PlaceExtractor("model",
5 region_names=set(json.load(open("gazetteer/region_names.json"))),
6 city_region=json.load(open("gazetteer/city_region.json")))
7gaz = json.load(open("gazetteer/city_country_gazetteer.json"))["case_insensitive"]
8gaz_multi = json.load(open("gazetteer/city_country_multi.json"))
9for e in ext.extract("A week in Tuscany, then Florence and Rome", gaz, gazetteer_multi=gaz_multi):
10 print(e["type"], e["text"], "->", e["region"], e["country"])transformers pipeline;
the gazetteer + scripts/ add the linking, region typing, and enrichment.model/ — DebertaV2ForTokenClassification (7 BIO tags) + tokenizer + bio_head.pt.gazetteer/ — city_country_gazetteer.json (name→country), city_country_multi.json
(ambiguous names, [country, language-editions, population]), region_names.json
(names typed REGION), city_region.json (city→admin-1 region).scripts/ — infer_place_extractor.py + _gen_common.py (the parameter-free linker, region
typing, enrichment, and compose).