Skip to content

Instantly share code, notes, and snippets.

@bbelderbos
Last active June 5, 2025 14:10
Show Gist options
  • Save bbelderbos/f1a27f3617c3ff16e72c6728675cec3d to your computer and use it in GitHub Desktop.
Save bbelderbos/f1a27f3617c3ff16e72c6728675cec3d to your computer and use it in GitHub Desktop.
# /// script
# dependencies = [
# "geotext",
# ]
# ///
from geotext import GeoText
places = GeoText("I went from Paris to Berlin.")
print(places.cities) # ['Paris', 'Berlin']
# testing it seems city names do need to be capitalized!
places = GeoText("How is the weather in Madrid today? And how about in Helsinki?")
print(places.cities) # ['Madrid', 'Helsinki'] # helsinki is not recognized
@bbelderbos
Copy link
Author

If not robust / flex enough, you could also try Spacy ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment