Skip to content
/ ALEX Public

A package consisting of services that provide a Natural Language User Interface for querying geographical data from OSM

License

Notifications You must be signed in to change notification settings

Geodan/ALEX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ALEX - A Linguistic EXchange geobot

This repository is a set of services and bots that allows users to query geographical data using natural language.

At the moment the package consists of:

- A telegram bot as a (very simple) I/O mechanism
- A query builder, which builds the queries from a sentence, runs it on a PostGIS server and then returns corresponding geojson
- An QGIS plugin, which allows users to send queries and see the results
in a vector layer.

At the moment, all of our code is written in Python. We plan of releasing the structure of the messages between components, so new appliances can be written in multiple languages.

Some words of warning

This project is very much in alpha state. While it is in a working condition at the moment, it is subject to big changes while in development. It is also still very buggy and the codebase needs to be restructured down the road.

But with this in mind

We would really appreciate any attention to this project! If you have any suggestions, ideas or help you can give, feel free to do so!

Installation

Python Requirements

Our components have requirements in the form of python modules. They can be found in the requirements.txt file.

Postgis

Some of our components require a PostGIS installation with the OSM (open street map) data loaded in. You can use the osm2pgsql package to achieve this. For more information, you can check their repository.

QueryBuilder

The default port for a PostgreSQL server is 8085. If you change the port, you have to edit this in the configuration file as well. You can find this configuration file under QueryBuilder/config.py. This file also contains other configuration options.

To build a query, we first have to classify the intents of the words we were given. We use a service called wit.ai for this. We trained our bot with a few intents.

- filters, which limit the amount of data given
- logic operators, which combine multiple filters
- local search queries, which are wat we search for
- arguments, such as distance and locations, which filters use to fill in blanks

To use our bot, yours has to be trained like ours. Information on this will be added later. For now you can experiment by adding your wit.ai token in QueryBuilder/config.py

You also need to download the wordnet and the stopwords corpora using the nltk downloader. To access the nltk downloader, first import nltk in the python interpreter and then run nltk.download()

Telegram bot

Our telegram bot is a fairly straightforward bot. First create a bot using the Botfather. Then get your token and put that in token.txt. After that, run the bot: python geo_query_bot.py

If you don't want to host it yourself: click on this link, which will add the bot on your telegram client.

QGIS plugin

To install the QGIS plugin, you (obviously) have to have QGIS installed. If that is the case, copy the QGISPlugin/GeodataNLUI to ~/.qgis2/python/plugins (if you are using linux). If you are using windows, you will have to find that out yourself for now :)

WebUI

Just host the files on a webserver and make sure the ip address in ui.js is correct!

About

A package consisting of services that provide a Natural Language User Interface for querying geographical data from OSM

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published