I am trying to extract the UK as a country name from text file using geograpy, but It's returning an empty list. My code is:
import geograpy
text = 'I am from the UK'
places = geograpy.get_place_context(text=text)
print (places.countries)
Output:
[]
Is there a way get ['UK'] as an output? Thank you.
Try places.other
:
lists everything that wasn't clearly a country, region or city.
import geograpy
text = 'I am from the UK'
places = geograpy.get_place_context(text=text)
print(places.other)
Output:
['UK']