Skip to main content

PERDIDO Geoparser python library

Project description

Perdido Geoparser Python library

PyPI Open In Colab PyPI - License

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

Installation

To install the latest stable version, you can use:

pip install --upgrade perdido

Quick start

Open In Colab

Import

from perdido import geoparser

Run geoparser

p = geoparser.Geoparser()
doc = p.parse('Je visite la ville de Lyon, Annecy et le Mont-Blanc.')

Get tokens

for token in doc.tokens:
    print("{0} {1} {2}".format(token.text, token.lemma, 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("{0} --> {1}".format(entity.text, entity.tag))
    if entity.tag == 'place':
        for t in entity.toponyms:
            print("{0} {1} - {2}".format(t.lat, t.lng, t.source))

Get the list of nested named entities

for nestedEntity in doc.nne:
    print("{0} --> {1}".format(nestedEntity.text, nestedEntity.tag))
    if nestedEntity.tag == 'place':
        for t in nestedEntity.toponyms:
            print("{0} {1} - {2}".format(t.lat, t.lng, 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.0.8.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

perdido-0.0.8-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for perdido-0.0.8.tar.gz
Algorithm Hash digest
SHA256 e4ea4f021008f24866699de9f9a1ced8dc5458f70deff5d787f1063d254d15c6
MD5 b9721eb3d72193b170b2d978a12c21e2
BLAKE2b-256 cb873a06ac2fdae0decf8b7366be626ea97c1add5966f746de5fcdd229b730e3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for perdido-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 47cd250933f8c85ba1297cf60eb76e1def8a88eb8d56be02ad281c8f23da44d2
MD5 7f2b889c9232c5c3b6c6470282c18dbb
BLAKE2b-256 c22a44073bf4605e3a3e1a327bdf1fb002afb0d155d59df6d9410da5a6f1cad2

See more details on using hashes here.

Supported by

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