Skip to main content

PERDIDO Geoparser python library

Project description

Perdido Geoparser Python library

Open In Colab PyPI PyPI - License PyPI - Python Version

http://erig.univ-pau.fr/PERDIDO/

Installation

To install the latest stable version, you can use:

pip install --upgrade perdido

Quick start

Geoparsing

Open In Colab

Import

from perdido.geoparser import Geoparser

Run geoparser

geoparser = Geoparser(lang='fr')
doc = geoparser('Je visite la ville de Lyon, Annecy et Chamonix.')

Get tokens

for token in doc:
    print(f'token: {token.text}\tlemma: {token.lemma}\tpos: {token.pos}')

Print the XML-TEI output

print(doc.tei)

Print the GeoJSON output

print(doc.geojson)

Get the list of named entities

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

Get the list of nested named entities

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

Perdido Geoparser REST APIs

http://choucas.univ-pau.fr/docs#

Example: call REST API in Python

import requests

url = 'http://choucas.univ-pau.fr/PERDIDO/api/'
service = 'geoparsing'
content = 'Je visite la ville de Lyon, Annecy et le Mont-Blanc.'
parameters = {'api_key': 'demo', 'content': content}

r = requests.post(url+service, params=parameters)

print(r.text)

Acknowledgements

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.5.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

perdido-0.1.5-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file perdido-0.1.5.tar.gz.

File metadata

  • Download URL: perdido-0.1.5.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for perdido-0.1.5.tar.gz
Algorithm Hash digest
SHA256 3f94181df0ff96208afe44b6932fd95ca142fc6808bcc366dec5d4dd9cf10da4
MD5 6bd7aa236be0833626a1e0f45ba671d2
BLAKE2b-256 c23ff2f7c664bd956980c7209a281a8afd6719946c3f2968e1992b92eea71cb3

See more details on using hashes here.

File details

Details for the file perdido-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: perdido-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for perdido-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2222d20296fab75448d6a77eb6c56aaf5053bdf2e689348f307a72d9df918326
MD5 15947755a8da695a4cca0a8688bcd12a
BLAKE2b-256 060169f9594e957e52b0b17810cf6c85b920154f279b89a1491ea3c974df64b8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page