API
- geonlplify.find_sne(text)[source]
Return list of SNE
- Parameters:
text – input text
- Returns:
list of SNE
- geonlplify.geocode(sne_name)[source]
Input a place name and retrieves OSM properties. Exemple for sne_name=”Montpellier”:
{‘osm_id’: 65442261, ‘osm_type’: ‘N’, ‘country’: ‘France’, ‘osm_key’: ‘place’, ‘city’: ‘Montpellier’, ‘countrycode’: ‘FR’, ‘osm_value’: ‘city’, ‘postcode’: ‘34062’, ‘name’: ‘Montpellier’, ‘county’: ‘Hérault’, ‘state’: ‘Occitanie’, ‘type’: ‘district’}
- Parameters:
sne_name –
- Returns:
a dictionary with OSM properties
- geonlplify.geonlplify(text, method='spatial_synonym')[source]
GeoNLPlify aims to make variations of an input sentence working on spatial information contained in words
- Examples:
>> geonlplify.geonlplify(“5 cases of avian influenza found in Montpellier”) 5 cases of avian influenza found in Bangalore
- Parameters:
text – Input
method – Between those 3 methods [generalization, specialization, spatial_synonym]
- Returns:
the variation of the input text
- geonlplify.importing_error_check()[source]
Check if there is any importing issue (like missing data or spacy model) :return:
- geonlplify.load_simplemaps()[source]
Load simplemaps from https://simplemaps.com/data/world-cities CC-BY 4.0 attribution from https://simplemaps.com/data/world-cities :return:
- geonlplify.replace_variants(text, list_of_variant, method, conserve_n_gram=True)[source]
- Parameters:
text –
list_of_variant –
example: - error:
[{‘name’: ‘South Sudan’, ‘label’: ‘GPE’, ‘start_char’: 56, ‘end_char’: 67, ‘generalization’: nan, ‘generalization_failed’: ‘sea’}]
- ok:
[{‘name’: ‘New Jersey’, ‘label’: ‘GPE’, ‘start_char’: 39, ‘end_char’: 49, ‘generalization’: ‘United States’}]
- Returns: