GithubHelp home page GithubHelp logo

aqgnet's Introduction

Data and Code for IJCAI 2020 paper Formal Query Building with Query Structure Prediction for Complex Question Answering over Knowledge Base is available for research purposes.

Requirements

  • Python 3.6
  • Pytorch 1.2.0
  • DBpedia Version 2016-04
  • SPARQL service (constructed by Virtuoso or Apache Jena Fuseki)

Running Code

Download Glove Embedding and put glove.42B.300d.txt under ./data/ directory.

1. Preprocess data for AQGNet

cd ./preprocess
sh run_me.sh

2. Training for AQGNet

Modify the following content in ./train.sh.

devices=$1
  • Replace $1 with the id of the GPU to be used, such as 0.
    Then, execute the following command for training.
sh train.sh

The trained model file is saved under ./runs directory.
The path format of the trained model is ./runs/RUN_ID/checkpoints/best_snapshot_epoch_xx_best_val_acc_xx_model.pt

3. Testing for AQGNet

Modify the following content in ./eval.sh.

devices=$1
save_name=$2
dbpedia_endpoint=$3
  • Replace $1 with the id of the GPU to be used.
  • Replace $2 with the path of the trained model.
  • Replace $3 with the address of the established DBpedia SPARQL service, such as http://10.201.158.104:3030/dbpedia/sparql

The result of AQGNet structure prediction is saved under the used model directory. The path format of result is ./runs/RUN_ID/results.pkl.
Then, execute the following command for structure prediction.

sh eval.sh

4. Generate candidate queries

Modify the following content in ./generate_queries.sh.

test_data=$1            # structure prediction results path
dbpedia_endpoint=$2     # http://10.201.158.104:3030/dbpedia/sparql

The candidate queries for the training set, valid set, and test set are saved under ./data directory.

5. Preprocess data for query ranking model

cd ./query_ranking
sh run_me.sh

6. Training for query ranking model

Modify the following content in ./query_ranking/train.sh.

devices=$1
  • Replace $1 with the id of the GPU to be used. Then, execute the following command for training query ranking model.
cd ./query_ranking
sh train.sh

The trained query ranking model file is saved under ./query_ranking/runs directory.

6. Test for query ranking model

Modify the following content in ./query_ranking/eval.sh.

devices=$1
save_name=$2
dbpedia_endpoint=$3
  • Replace $1 with the id of the GPU to be used.
  • Replace $2 with the path of the trained model.
  • Replace $3 with the address of the established DBpedia SPARQL service, such as http://10.201.158.104:3030/dbpedia/sparql.

Then, execute the following command for the final results of question answering.

cd ./query_ranking
sh eval.sh

Citation

If you use AQGNet, please cite the following work.

@inproceedings{DBLP:conf/ijcai/ChenLHQ20,
  author    = {Yongrui Chen and
               Huiying Li and
               Yuncheng Hua and
               Guilin Qi},
  editor    = {Christian Bessiere},
  title     = {Formal Query Building with Query Structure Prediction for Complex
               Question Answering over Knowledge Base},
  booktitle = {Proceedings of the Twenty-Ninth International Joint Conference on
               Artificial Intelligence, {IJCAI} 2020 [scheduled for July 2020, Yokohama,
               Japan, postponed due to the Corona pandemic]},
  pages     = {3751--3758},
  publisher = {ijcai.org},
  year      = {2020},
  url       = {https://doi.org/10.24963/ijcai.2020/519},
  doi       = {10.24963/ijcai.2020/519},
  timestamp = {Mon, 13 Jul 2020 18:09:15 +0200},
  biburl    = {https://dblp.org/rec/conf/ijcai/ChenLHQ20.bib},
  bibsource = {dblp computer science bibliography, https://dblp.org}
}

aqgnet's People

Watchers

 avatar

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.