geotext
Geotext extracts countriy and city mentions from text
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 geotextuv
uv add geotextpoetry
poetry add geotextInstalling 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
Tags
More Text Processing packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyparsingpyparsing provides a library for building text…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
RapidFuzzRapidFuzz provides fast fuzzy string matching…
permissive · top 1,000 on PyPI
tinycss2tinycss2 parses CSS strings into token and…
permissive · top 1,000 on PyPI
llama-parseLlamaParse parses complex documents (PDFs,…
permissive · top 1,000 on PyPI
geonamescacheProvides Python dictionaries of geographic data…
permissive · top 5,000 on PyPI
reverse-geocodeReverse Geocode converts latitude/longitude…
copyleft · top 15,000 on PyPI
django-cities-lightProvides Django models and management commands…
permissive · top 15,000 on PyPI
pyap2Pyap2 detects and parses postal addresses from…
permissive · top 15,000 on PyPI
countryinfoCountryinfo provides a Python interface to…
permissive · top 15,000 on PyPI
pyapPyap detects and parses postal addresses from…
permissive · top 15,000 on PyPI
goose3Extracts article text, metadata, images, and…
permissive · top 15,000 on PyPI
geoip2Queries MaxMind's GeoIP web services and…
permissive · top 5,000 on PyPI
reverse_geocoderReverse Geocoder converts latitude/longitude…
copyleft · top 15,000 on PyPI
IP2LocationLooks up geolocation data (country, region,…
permissive · top 15,000 on PyPI