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

Uploaded Source

Built Distribution

perdido-0.0.6-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: perdido-0.0.6.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.6.tar.gz
Algorithm Hash digest
SHA256 751be3ae890e61c11f1c5904c6e18974667916921611745fc78fa0fb3c524774
MD5 1d8bf14b4b83c213ba9503c53cd39fad
BLAKE2b-256 8ea65f3a94f9ae0b99473ff5fce3b20213472ff3effaad8bd426e2fc838040b0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perdido-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 8.2 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 763f580c00403ee4c9e917668fe43e93d647e90b5cd4a709f8418abb74581aba
MD5 8ab545870f468bf398f07413e12849af
BLAKE2b-256 119accf54f85d2e5f508547d1f4622b0782d60abdc9c9a9c592f933a80b093b1

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