Python 基于地理位置的提取和分离

Python 基于地理位置的提取和分离,python,nlp,Python,Nlp,我有如下字符串列表: ["Ola, Uber's India rival, invests $100M in scooter rental startup Vogo","Chattanooga startup Bellhops Moving raises over $31 million in latest", "Boston biotech Entrada launches with $59M to tackle deadly disease"] 我想从字符串列表中识别像印度、波士顿、查塔努

我有如下字符串列表:

["Ola, Uber's India rival, invests $100M in scooter rental startup Vogo","Chattanooga startup Bellhops Moving raises over $31 million in latest", "Boston biotech Entrada launches with $59M to tackle deadly disease"]
我想从字符串列表中识别像印度、波士顿、查塔努加这样的字符串,这些字符串是城市、城镇、国家、州或大陆,并根据地区将它们分开


我无法找到一个合适的路径或方法来实现这个特定的输出。任何建议都会非常有用。

要检测可能使用geotext的国家和城市:

您需要使用geotext库。您可以通过在windows的命令提示符
cmd
中键入以下命令来安装它

pip install https://github.com/elyase/geotext/archive/master.zip
安装后,您可以提取城市和国家

from geotext import GeoText
your_list=["Ola, Uber's India rival, invests $100M in scooter rental startup Vogo","Chattanooga startup Bellhops Moving raises over $31 million in latest", "Boston biotech Entrada launches with $59M to tackle deadly disease"]
complete_string=','.join(map(str,your_list) ) # converting the list 'your_list' to string
locations=GeoText(complete_string)
locations.countries
    ['India']
locations.cities
    ['Chattanooga', 'Boston']

我的建议是使用Spacy和NER