I use Python 3 (I also have Python 2 installed) and I want to extract countries or cities from a short text.
For example, text = "I live in Spain"
or text = "United States (New York), United Kingdom (London)"
.
The answer for countries:
- Spain
- [United States, United Kingdom]
I tried to install geography
but I am unable to run pip install geography
. I get this error:
Collecting geography Could not find a version that satisfies the
requirement geography (from versions: ) No matching distribution found
for geography
It looks like geography
only works with Python 2.
I also have geopandas
, but I don't know how to extract the required info from text using geopandas.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…