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

Usage

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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: perdido-0.0.7.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.7.tar.gz
Algorithm Hash digest
SHA256 9c22623f92a43056beb618b888ea058f2a8ba5519b2c67ecd9edc9bf11991e12
MD5 60e1fbf389c1cb092f311ea6d3dda18e
BLAKE2b-256 e37337207c068e2a3746df24b79e4bb93a4e1e445804267d4b5c31b458bb0e51

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perdido-0.0.7-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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 edb2e2bb96746dded97da860ee231cce90ccc73c755b4c3fdb198a72045b0903
MD5 b6ee6c896f7a6f4d3c8800c01aa09991
BLAKE2b-256 4595efe697beb40c233bf8f666280fade3a59eb91847995a81f5c9cb3f00f1e4

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