Tag the names of countries and in text.
Project description
countrytagger
This library finds the names of places in a string of text and tries to associate them with countries. The goal is to tag a piece (or set) of text with country metadata. The place names are derived from the GeoNames database, and they include names of countries, major administrative areas and large cities. Place names that are used in several countries are not used.
Usage
import countrytagger
# match in a string using sequential matching:
text = 'I am in Berlin'
for (code, score, country) in countrytagger.tag_text_countries(text):
print(score, country)
# find precise matches:
code, score, country = countrytagger.tag_place('Berlin')
Building the data
You can re-generate the place database like this:
$ make generate
This will download GeoNames and parse it into the format used by this library.
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
File details
Details for the file countrytagger-0.1.2.tar.gz
.
File metadata
- Download URL: countrytagger-0.1.2.tar.gz
- Upload date:
- Size: 693.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aeb5e9e01dd824c4499b9c12ba06b6967cd3aee26ee7518958a435832a8b7701 |
|
MD5 | e8c11044d36c8be1fd83da2e667064d1 |
|
BLAKE2b-256 | 6973d9383acb6052226acc64572278067f9c9258acc570efc41ea30f3fa5a5e1 |
File details
Details for the file countrytagger-0.1.2-py2.py3-none-any.whl
.
File metadata
- Download URL: countrytagger-0.1.2-py2.py3-none-any.whl
- Upload date:
- Size: 703.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64f53d71db4917744b0d76104a444c9a025a30409e7892e8c506539850ce4d24 |
|
MD5 | 9b4f06a16b336cc68556019a833a360f |
|
BLAKE2b-256 | 73d9d792e5b2b77d934ed3ed0a15a2742a0e6f57f6c682a1b65b33512e981ff6 |