Skip to main content

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.

Metadata

Release files for countrytagger 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for countrytagger 0.1.2
File Size Uploaded Provenance Actions
countrytagger-0.1.2.tar.gz 693.7 kB Without provenance Details for countrytagger-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for countrytagger 0.1.2
File Interpreter ABI Platform Actions
countrytagger-0.1.2-py2.py3-none-any.whl Python 2, Python 3 none any Details for countrytagger-0.1.2-py2.py3-none-any.whl

Total release size: 1.4 MB

Release files / countrytagger-0.1.2.tar.gz

Download URL countrytagger-0.1.2.tar.gz
Size 693.7 kB
Tags Source
SHA-256 checksum
How to use checksums
aeb5e9e01dd824c4499b9c12ba06b6967cd3aee26ee7518958a435832a8b7701
BLAKE2b-256 checksum
How to use checksums
6973d9383acb6052226acc64572278067f9c9258acc570efc41ea30f3fa5a5e1
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / countrytagger-0.1.2-py2.py3-none-any.whl

Download URL countrytagger-0.1.2-py2.py3-none-any.whl
Size 703.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
64f53d71db4917744b0d76104a444c9a025a30409e7892e8c506539850ce4d24
BLAKE2b-256 checksum
How to use checksums
73d9d792e5b2b77d934ed3ed0a15a2742a0e6f57f6c682a1b65b33512e981ff6
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for countrytagger 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

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