1

Using geograpy3 (https://pypi.org/project/geograpy3/):

> import geograpy
> text = "Welcome to beautiful Seattle"
> p = geograpy.get_geoPlace_context(text=text)
> p.cities
['Seattle']
> p.countries
['United States']
> p.regions
[]

Is there a package or dataset I need to download?

Matt Simmons
  • 678
  • 1
  • 8
  • 13

1 Answers1

0

I am answering as a committer of geograpy3. There is a new locator interface intended for improvements in disambiguation and location. It is not fully integrated yet with the Natural Language Processing part yet - issues and pull requests are welcome ...

def testStackOverflow64418919(self):
        '''
        https://stackoverflow.com/questions/64418919/problem-retrieving-region-in-us-with-geograpy3
        '''
        examples=['Seattle']
        for example in examples:
            city=geograpy.locateCity(example,debug=False)
            print(city)

Result:

Seattle (US-WA(Washington) - US(United States))
Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186