无法使用地理从文本中提取国家/地区名称 'UK'

Unable to extract country name 'UK' from text using geograpy

我正在尝试使用 geograpy 从文本文件中提取英国作为国家/地区名称,但它返回的是一个空列表。我的代码是:

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

print (places.countries)

输出:

[]

有没有办法将 ['UK'] 作为输出?谢谢。

尝试 places.<b>other</b>:

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)

输出:

['UK']