skillfed

geotext

Geotext extracts countriy and city mentions from text

geotext v0.4.0 98.6K downloads/30d#13,070 on PyPI140
Permissive license MIT Abandoned released

What it is and what it does

Geotext is a lightweight Python library that identifies and extracts country and city names from plain text. It parses input strings and returns structured results: a list of detected cities, a list of detected countries, and a frequency count of country mentions by ISO code. You can optionally filter results to cities within a specific country by passing a country code.

The package relies on a built-in geographic database derived from geonames.org data and has no external runtime dependencies, making it fast and simple to integrate. It was last updated in 2018 and is no longer maintained; the repository is archived. While the core extraction logic remains functional, the underlying geographic data may not reflect recent city or country name changes, and compatibility with modern Python versions is untested.

Use it for:

  • Extract city and country names from user-generated content, reviews, or social media posts for geographic analysis.
  • Filter travel or news articles by location mentions to organize content by region or country.
  • Preprocess text data for geospatial machine learning pipelines that require structured location labels.
  • Identify geographic scope in customer feedback or support tickets without external API calls.
  • Build lightweight location-aware search or tagging systems where offline extraction is preferred.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Geotext extracts mentions of countries and cities from unstructured text, returning them as structured data with optional filtering by country code.

Yes, if you need simple, offline geographic entity extraction and can tolerate an unmaintained codebase. The lack of dependencies and low install friction make it attractive for lightweight projects. However, do not use it if you require current geographic data, active bug fixes, or support for modern Python versions—consider an actively maintained alternative for production systems.

Install

geotext on PyPI

pip

pip install geotext

uv

uv add geotext

poetry

poetry add geotext

Installing geotext

Before you install

Installation is frictionless—the package has no runtime dependencies and ships as a pure Python wheel. However, the project is archived and abandoned; the last commit was in 2022 and no releases have occurred since 2018, so maintenance and bug fixes are not forthcoming.

License in practice

MIT is a permissive license, so you may use, modify, and distribute geotext freely in commercial and private projects with minimal restrictions. The underlying geographic data is licensed under Creative Commons Attribution 3.0.

Quickstart

pip install geotext

from geotext import GeoText

places = GeoText("London is a great city")
print(places.cities)  # ['London']
print(places.country_mentions)  # OrderedDict([(u'GB', 1)])

Verify before relying

  • Whether the geographic database (from geonames.org) is current enough for modern city and country name coverage.
  • Compatibility with Python versions beyond 3.6, given the package has not been updated since 2018.
  • Accuracy and recall of extraction on non-English text or transliterated place names.

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 2,937 days since the last release
Last repo commit (repository archived)
First released
Downloads 98,627/month — #13,070 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: geotext-0.4.0-py2.py3-none-any.whl

Keywords: geotext

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 2.7Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6

Tags

extract cities from textcountry mention extractiongeographic entity recognitioncity name detectionplace name extractiongeotext parsinglocation mention finder
nlpgeolocationlightweight

More Text Processing packages