4

I am trying to extract countries/cities name from text file using geograpy (https://pypi.python.org/pypi/geograpy/0.3.7), but It's returning a empty list. My code is:

import geograpy
text = 'I am from Delhi'
places = geograpy.get_place_context(text=text)

print places.cities

Output:

[]

Why it is not extracting cities name?? Is there any way I can resolve it??

Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186
neha
  • 335
  • 3
  • 5
  • 19

1 Answers1

5

I don't know about geograpy but, you could try geotext

from geotext import GeoText
sentence = "I am from Delhi"
places = GeoText(sentence)
print places.cities

['Delhi']

nazeer shaik
  • 51
  • 1
  • 3