PERDIDO Geoparser python library
Project description
Perdido Geoparser Python library
http://erig.univ-pau.fr/PERDIDO/
Installation
To install the latest stable version, you can use:
pip install --upgrade perdido
Quick start
Geoparsing
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:
- GEODE (2020-2024): LabEx ASLAN (ANR-10-LABX-0081)
- GeoDISCO (2019-2020): MSH Lyon St-Etienne (ANR‐16‐IDEX‐0005)
- CHOUCAS (2017-2022): ANR (ANR-16-CE23-0018)
- PERDIDO (2012-2015): CDAPP and IGN
Project details
Release history Release notifications | RSS feed
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.0.tar.gz
(8.7 kB
view details)
Built Distribution
File details
Details for the file perdido-0.1.0.tar.gz
.
File metadata
- Download URL: perdido-0.1.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70e08a5686226a17d049736b61a4be194b33dc52c8e4a635080177fe0b070e4e |
|
MD5 | 57904a18fe2faad80ea101d504245c74 |
|
BLAKE2b-256 | 8988fd1b4f2c7c3d2cbb755f0cdfa1c279288011977636ab02d6851443ba2307 |
File details
Details for the file perdido-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: perdido-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df1549dd3aa525b7b8bb7c1870b68ac93affd363d6548f40acafeefe71f5c399 |
|
MD5 | 598043d38b0c4c290c88e6044b9f0341 |
|
BLAKE2b-256 | 564bbdf062c261c6f2ce2d769b2fd2f8e866b8d324929556923801f5f82ac569 |