Skip to main content

Irchel Geoparser

CI Coverage PyPI Downloads Python License

A Python library for extracting place names from text and linking them to geographic locations.

Geoparsing is split into two stages, and the library keeps them separate: a recognizer finds which words are place names, and a resolver decides which place each name refers to, choosing from the entries of a gazetteer. You supply the recognizer, the resolver, and the gazetteer explicitly, and each can be exchanged for another: a module can be replaced by one that works differently, pointed at a different underlying model, or fine-tuned on your own annotated data, and you can write a module of your own against a small interface. The library ships gazetteer configurations for the modern world and for Switzerland, and other geographic data becomes a gazetteer through a YAML configuration file, with no code to write.

Installation

pip install geoparser

The library also needs a gazetteer, which is not bundled: it is the database of places that names are resolved against.

python -m geoparser install geonames

See the installation guide for environment setup, the available gazetteers, and their disk requirements.

Quick Start

from geoparser import Geoparser
from geoparser.modules import SentenceTransformerResolver, SpacyRecognizer

# Build a pipeline from a recognizer and a resolver
geoparser = Geoparser(
    recognizer=SpacyRecognizer(),
    resolver=SentenceTransformerResolver(gazetteer_name="geonames"),
)

# Parse text
document = geoparser.parse(
    "The conference was held in Zurich, with satellite events in Geneva and Basel."
)

# Access results
for toponym in document.toponyms:
    location = toponym.location  # None if the name could not be resolved
    print(f"{toponym.text} -> {location.data['name']}, {location.data['country_name']} "
          f"({location.data['latitude']}, {location.data['longitude']})")
Zurich -> Zürich, Switzerland (47.36667, 8.55)
Geneva -> Geneva, Switzerland (46.20222, 6.14569)
Basel -> Basel, Switzerland (47.55839, 7.57327)

Each name here has been tied to one specific entry in GeoNames, so besides the name and coordinates printed above you also have a stable identifier for the place, what kind of place it is, the administrative units it belongs to, and a geometry you can map, measure, or export.

Documentation

Full documentation, including setup, guides, and the API reference, is available at docs.geoparser.app.

Project Status

The library is under active development and its architecture is still evolving; while the version remains below 1.0, minor releases may make breaking changes. ROADMAP.md describes the larger changes we intend to make.

Contributing

Questions, bug reports, and ideas are always welcome via issues. Pull requests are appreciated too — see CONTRIBUTING.md for local setup and development guidelines.

Acknowledgments

The Irchel Geoparser originated as part of Diego Gomes' Master's thesis and was further developed with support from the Department of Geography at the University of Zurich and the Public Data Lab of the Digitalization Initiative of the Zurich Higher Education Institutions. We thank Prof. Dr. Ross Purves for the opportunity to continue this work as part of a research project.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Geoparser depends on a number of third-party libraries, listed in pyproject.toml. Each is distributed separately under its own license, which pip installs alongside it.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geoparser-0.6.0.tar.gz (99.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geoparser-0.6.0-py3-none-any.whl (139.3 kB view details)

Uploaded Python 3

File details

Details for the file geoparser-0.6.0.tar.gz.

File metadata

  • Download URL: geoparser-0.6.0.tar.gz
  • Upload date:
  • Size: 99.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for geoparser-0.6.0.tar.gz
Algorithm Hash digest
SHA256 63d8cfb48d491d97d7c3ef2e6f3e23f746b255c1eb5e366545dd266e0bf9eec7
MD5 2da18794f9324d439c36cd0b6108f573
BLAKE2b-256 a879e0e1bc19b7c18a24973ce6cf2b59bf137c95f715780cad8ee48ec252d4e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for geoparser-0.6.0.tar.gz:

Publisher: release.yml on dguzh/geoparser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file geoparser-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: geoparser-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 139.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for geoparser-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 260fe49b3e98ea4eddccac89470c85a0de1973acbccecfd3d4d6950cf671649f
MD5 4d7fefc3386fca85f1c28189a4ee82f5
BLAKE2b-256 af31135b0a7049d251205dfacac0870a99988b383629d0b82efe873de61282b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for geoparser-0.6.0-py3-none-any.whl:

Publisher: release.yml on dguzh/geoparser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 files

0.5.0

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

1 file

0.1.1

1 file

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page