Coder Social home page Coder Social logo

asknowqa / sqg Goto Github PK

View Code? Open in Web Editor NEW
49.0 8.0 26.0 98.94 MB

Query Generation for Question Answering over Knowledge Bases

License: GNU General Public License v3.0

Python 94.07% Shell 0.09% Java 5.54% Dockerfile 0.30%
query-builder dbpedia lc-quad knowledgebase

sqg's Introduction

Query Generation

Question answering (QA) systems over Knowledge Graph often consist of several components such as Named Entity Disambiguation (NED), Relation Extraction (RE), and Query Generation (QG). The main objective of this project is to generate SPARQL query for a given question which is annotated by its linked entities and relations.

SQG is a SPARQL Query Generator with modular architecture, enabling easy integration with other components for the construction of a fully functional QA pipeline. To increase the chance constructthe correct query, SQG is able to handle a set of annotations including several incorrect ones. It also benefits from Tree-LSTM model to deal with syntactic ambiguity of the input questions. Special adjustment is considered in order to cope with large-scale knowledge base.

Supported Questions

Currently the following questions are supported:

  • Single entity relation questions
  • Compound questions
  • Count questions
  • Boolean questions

Cite

If you would use the codebase, please cite our paper as well:

@inproceedings{zafar2018formal,
  title={Formal query generation for question answering over knowledge bases},
  author={Zafar, Hamid and Napolitano, Giulio and Lehmann, Jens},
  booktitle={European Semantic Web Conference},
  pages={714--728},
  year={2018},
  organization={Springer}
}

How-to

Data

Getting Started

You can find the list of required packages in here.

To run it (python 2.7 is required):

python sqg_webserver.py

Consume Web API

SQG provides a RESTfull api for the query generator.

Here is an example of how to use the api:

curl -i -H "Content-Type: application/json" -X POST -d '{"question":"What is the hometown of Nader Guirat, where Josef Johansson was born too?","relations":[{"surface":"","uris":[{"confidence":1,"uri":"http://dbpedia.org/property/birthPlace"}]},{"surface":"","uris":[{"confidence":1,"uri":"http://dbpedia.org/ontology/hometown"}]}],"entities":[{"surface":"","uris":[{"confidence":0.7,"uri":"http://dbpedia.org/resource/Josef_Johansson"},{"confidence":0.3,"uri":"http://dbpedia.org/resource/Barack_Obama"}]},{"surface":"","uris":[{"confidence":1,"uri":"http://dbpedia.org/resource/Nader_Guirat"}]}],"kb":"dbpedia"}' http://localhost:5000/qg/api/v1.0/query

License

This program is subject to the terms of the General Public License (GPL), Version 3.0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.