Skip to content
/ NlpSQL Public

Building MySQL query using natural language processing

Notifications You must be signed in to change notification settings

SalN3t/NlpSQL

Repository files navigation

NlpSQL

NlpSQL is a question answering system that uses natural language processing to generat SQL statements. I used NLTK <http://nltk.org/> to parse the text and created a parse grammar to build the SQL query. The goal of the project is to create an easy way for regular to fetch data from the database even if they don't know SQL language. The database engin used in this project is MySQL <https://www.mysql.com/>

License

NlpSQL is free software, released under the MIT.

Requirements

You will need some Python packages

To install dependencies (on a Debian-like GNU/Linux distribution):

git clone https://github.com/SalN3t/NlpSQL.git
cd NlpSQL
pip install requirements.txt

You will also need to download some NLTK data package. You can do so executing:

python -m nltk.downloader genesis maxent_treebank_pos_tagger punkt stopwords averaged_perceptron_tagger

You will also need MySQL database. You can do so if you don't have it by:

apt-get install mysql

Now you would need to create the databse schema provided. A good tutorial Create a MySQL Database on Linux via Command Line

Please make sure to name the database employees Ok, Now we will need to papulate the data:

mysql -u username -p employee < schema.sql

You would need to update the config file to connect to the databse by filling the data:

nano config.py

Then Change the following:

db_config = {
    'user': '##username##',
    'passwd': '##password##',
    'host': '##host##',   
    'db': 'employees',
    }

That's it!

Runing

Make sure you fulfill the requirements First.

To run:

python main.py

YouTube Demo

Demo

About

Building MySQL query using natural language processing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages