Skip to content

Latest commit

 

History

History
18 lines (18 loc) · 577 Bytes

File metadata and controls

18 lines (18 loc) · 577 Bytes

Extract countries from text

Use

pip install geotext

Then

from geotext import GeoText
GeoText('Maybe this way: Viet Nam, or this other way: Vietnam'  ).countries
Out[]: ['Vietnam']

Add country alias to existing two-letter code (or extra country with new two-letter code)

GeoText.index[2]['viet nam']='VI'
GeoText('Maybe this way: Viet Nam, or this other way: Vietnam'  ).countries
Out[]: ['Viet Nam', 'Vietnam']

For additional information and other tools usage, see this post