Skip to main content

PERDIDO Geoparser python library

Project description

Perdido Geoparser Python library

PyPI PyPI - License PyPI - Python Version


To install the latest stable version, you can use:

pip install --upgrade perdido

Quick start


Binder Open In Colab


from perdido.geoparser import Geoparser

Run geoparser

geoparser = Geoparser(version='Standard')
doc = geoparser('Je visite la ville de Lyon, Annecy et Chamonix.')
  • The version parameter can take 2 values: Standard (default), Encyclopedie.

Get tokens

  • Access token attributes:
for token in doc:
    print(f'{token.text}\tlemma: {token.lemma}\tpos: {token.pos}')
  • Get the IOB format:
for token in doc:
  • Get a TSV-IOB format:
for token in doc:

Print the XML-TEI output


Print the GeoJSON output


Get the list of named entities

for entity in doc.named_entities:
    print(f'entity: {entity.text}\ttag: {entity.tag}')
    if entity.tag == 'place':
        for t in entity.toponyms:
            print(f' latitude: {}\tlongitude: {t.lng}\tsource {t.source}')

Get the list of nested named entities

for nestedEntity in doc.nested_named_entities:
    print(f'entity: {nestedEntity.text}\ttag: {nestedEntity.tag}')
    if nestedEntity.tag == 'place':
        for t in nestedEntity.toponyms:
            print(f' latitude: {}\tlongitude: {t.lng}\tsource {t.source}')

Shows named entities and nested named entities using the displacy library from spaCy

displacy.render(doc.to_spacy_doc(), style="ent", jupyter=True)
displacy.render(doc.to_spacy_doc(), style="span", jupyter=True)

Saving results



Binder Open In Colab


from perdido.geocoder import Geocoder

Geocode a single place name

geocoder = Geocoder()
doc = geocoder('Lyon')

Geocode a list of place names

geocoder = Geocoder()
doc = geocoder(['Lyon', 'Annecy', 'Chamonix'])

Get the geojson result


Get the list of toponym candidates

for t in doc.toponyms: 
    print(f'lat: {}\tlng: {t.lng}\tsource {t.source}\tsourceName {t.source_name}')

Perdido Geoparser REST APIs

Example: call REST API in Python

import requests

url = ''
service = 'geoparsing'
data = {'content': 'Je visite la ville de Lyon, Annecy et le Mont-Blanc.'}
parameters = {'api_key': 'demo'}

r =, params=parameters, json=data)



Perdido is an active project still under developpement.

This work was partially supported by the following projects:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

perdido-0.1.27.tar.gz (34.7 MB view hashes)

Uploaded source

Built Distribution

perdido-0.1.27-py3-none-any.whl (36.0 MB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page