trunghlt / sparc_atis_pytorch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CD-Seq2Seq for SParC and CoSQL

This is a pytorch implementation of the CD-Seq2Seq baseline in the following papers

Please cite the papers if you use our data and code.

@InProceedings{yu2019sparc,
  author =      "Tao Yu, Rui Zhang, Michihiro Yasunaga, Yi Chern Tan, Xi Victoria Lin, Suyi Li, Heyang Er, Irene Li, Bo Pang, Tao Chen, Emily Ji, Shreya Dixit, David Proctor, Sungrok Shim, Jonathan Kraft, Vincent Zhang, Caiming Xiong, Richard Socher, Dragomir Radev",
  title =       "SParC: Cross-Domain Semantic Parsing in Context",
  booktitle =   "Proceedings of The 57th Annual Meeting of the Association for Computational Linguistics",
  year =        "2019",
  address =     "Florence, Italy"
}

@InProceedings{yu2019cosql,
  author =      "Tao Yu, Rui Zhang, He Yang Er, Suyi Li, Eric Xue, Bo Pang, Xi Victoria Lin, Yi Chern Tan, Tianze Shi, Zihan Li, Youxuan Jiang, Michihiro Yasunaga, Sungrok Shim, Tao Chen, Alexander Fabbri, Zifan Li, Luyao Chen, Yuwen Zhang, Shreya Dixit, Vincent Zhang, Caiming Xiong, Richard Socher, Walter Lasecki, Dragomir Radev",
  title =       "CoSQL: A Conversational Text-to-SQL Challenge Towards Cross-Domain Natural Language Interfaces to Databases",
  booktitle =   "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
  year =        "2019",
  address =     "Hong Kong, China"
}

@InProceedings{zhang2019editing,
  author =      "Rui Zhang, Tao Yu, He Yang Er, Sungrok Shim, Eric Xue, Xi Victoria Lin, Tianze Shi, Caiming Xiong, Richard Socher, Dragomir Radev",
  title =       "Editing-Based SQL Query Generation for Cross-Domain Context-Dependent Questions",
  booktitle =   "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
  year =        "2019",
  address =     "Hong Kong, China"
}

Contact Rui Zhang for any question.

Dependency

The model is tested in python 3.6 and pytorch 1.0. We recommend using conda and pip:

conda create -n cdseq2seq python=3.6
source activate cdseq2seq
pip install -r requirements.txt

The evaluation scripts use python 2.7

Run SParC experiment

First, download SParC from here. Then please follow

  • run_sparc_cdseq2seq.sh. We saved our experimental logs at logs/logs_sparc_cdseq2seq
  • use segment copy: run_sparc_cdseq2seq_segment_copy.sh. We saved our experimental logs at logs/logs_sparc_cdseq2seq_segment_copy

This reproduces the SParC result in "Editing-Based SQL Query Generation for Cross-Domain Context-Dependent Questions".

Question Match Interaction Match
Dev Test Dev Test
CD-Seq2Seq 21.9 - 8.1 -
CD-Seq2Seq+segment copy (use predicted query) 21.7 - 9.5 -
CD-Seq2Seq+segment copy (use gold query) 27.3 - 10.0 -

Run CoSQL experiment

First, download CoSQL from here. Then please follow

  • run_cosql_cdseq2seq.sh. We saved our experimental logs at logs/logs_cosql_cdseq2seq

This reproduces the SQL-grounded dialog state tracking result in "CoSQL: A Conversational Text-to-SQL Challenge Towards Cross-Domain Natural Language Interfaces to Databases".

Question Match Interaction Match
Dev Test Dev Test
CD-Seq2Seq 13.8 13.9 2.1 2.6

Run ATIS experiment

To get ATIS data and get evaluation on the result accuracy, you need get ATIS data from here, set up your mysql database for ATIS and change --database_username and --database_password in parse_args.py.

Please follow run_atis.sh

This reproduces the ATIS result in "Learning to map context dependent sentences to executable formal queries". We saved our experimental logs at logs/logs_atis

Dev Test
Query Relaxed Strict Query Relaxed Strict
Suhr et al., 2018 37.5(0.9) 63.0(0.7) 62.5(0.9) 43.6(1.0) 69.3(0.8) 69.2(0.8)
Our Replication 38.8 63.3 62.8 44.6 68.3 68.2

Acknowledgement

This implementation is based on "Learning to map context dependent sentences to executable formal queries". Alane Suhr, Srinivasan Iyer, and Yoav Artzi. In NAACL, 2018.

About


Languages

Language:Python 98.1%Language:Shell 1.9%