followthemoney query dsl and io helpers
Project description
geonames-tagger
This library finds the names of places in a string of text and tries to associate them with known locations from geonames.org. The goal is to tag a piece (or set) of text with mentioned locations, optionally to refine location names to a more canonized value. As well, the corresponding geoname IDs are returned in a tagging result.
As opposed to the original countrytagger, this library doesn't ship with the data included, so one needs to build it locally and then use it with the GEONAMES_DB env var set.
Data
Usage of the GeoNames data is licensed under a Creative Commons Attribution 4.0 License. Please verify that usage complies with your project.
Install
pip install geonames-tagger
Usage
cli
echo "I am from Berlin, Germany" | geonames-tagger tag
this results in the following json response:
python
from geonames_tagger import tag_location:
text = 'I am in Berlin'
for result in tag_locations(text):
print(result.name) # the normalized but original name found in text
print(result.caption) # the canonical names as list from GeoNames db
print(result.ids) # the GeoName IDs
Building the data
You can re-generate the place database like this:
geonames-tagger build
This will download GeoNames and parse it into the format used by this library.
License and Copyright
geonames-tagger, (C) 2025 Data and Research Center – DARC
geonames-tagger is licensed under the AGPLv3 or later license.
The original countrytagger is released under the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file geonames_tagger-1.0.0.tar.gz.
File metadata
- Download URL: geonames_tagger-1.0.0.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.13.5 Linux/6.12.41+deb13-amd64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0d7db3dd9a6e3ed53e482bcb26e7daad6c85b708c9ba0c1b687785b008df44a
|
|
| MD5 |
2fd39fece0f88f15dfdc056433bf00e8
|
|
| BLAKE2b-256 |
b02d5a7b6d538ad23348eda9a40b09b199a90fbc5cfeabbb91b64bfdf3fa8185
|
File details
Details for the file geonames_tagger-1.0.0-py3-none-any.whl.
File metadata
- Download URL: geonames_tagger-1.0.0-py3-none-any.whl
- Upload date:
- Size: 20.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.13.5 Linux/6.12.41+deb13-amd64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9ed87cc7079245e84f11cd8621a1c154fd4c29cb658c267d77b61c9e41eadf7
|
|
| MD5 |
0f3b7ad68dae7c4882d0d9903d234a88
|
|
| BLAKE2b-256 |
e23c2c353fc10dd7fb87a050af605ee1ff76f7de19d5997b878e3a5cb391208d
|