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
Usage
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:
- 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.0.6.tar.gz
(6.7 kB
view hashes)