Skip to main content

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


Download files

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

Source Distribution

countrytagger-0.1.1.tar.gz (693.7 kB view details)

Uploaded Source

Built Distribution

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

countrytagger-0.1.1-py2.py3-none-any.whl (703.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file countrytagger-0.1.1.tar.gz.

File metadata

  • Download URL: countrytagger-0.1.1.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

Hashes for countrytagger-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c400ba8395c1653ca495580bf275f5cd7111eb384030f8b596e88a9cc151bf08
MD5 3b23db605d47da846f1ae5a8a47ef2e5
BLAKE2b-256 14e51d4f514f4f692a499b159a126f2d4d14db9ccc32890fec0502acb5878d1a

See more details on using hashes here.

File details

Details for the file countrytagger-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: countrytagger-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 703.8 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

Hashes for countrytagger-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 da963e340ad6b275eef41ef9650c0e68a7649aec3d4c2aa301a08d5c3aec624c
MD5 56237d0a358bd3d728c9c57a3932d300
BLAKE2b-256 0d8a504675ec30febcf16573c31325b754559f61a16241f62f7759dc2aa91deb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page