Code for ACL 2019 long paper Ensuring Readability and Data-fidelity using Head-modifier Templates in Deep Type Description Generation based on OpenNMT-py.
-
Python 3.5+
-
PyTorch 1.0
pip install -r requirements.txt
Download stanford corenlp from here, and place them in the corenlp/
folder.
The start CoreNLP by running the following commands within the folder,
java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000
Demo can be found in raw/annotate_desc.py
python annotate_desc.py
Download the processed dataset from here, and place them in the data/dataNK/
folders.
Download the raw infobox data from here, place them in the raw/infobox/dataNK/
, and run the following to convert raw infobox to sentences.
python build_dataset.py --config config/demo-prep.yml
It may take a while. :).
Preprocess dataset into *.pt.
python preprocess.py --config config/demo-prep.yml
python train.py --config config/demo-train.yml
python test.py --config config/demo-test.yml
Simply add -report_bleu
in test commands, or run
python evaluation.py $result_file$ $golden_file$
Start Stanford CoreNLP, then in the folder eval/
, run
python modcopy.py -src somewhere/src-test.txt -res result_file
python hedacc.py -src somewhere/src-test.txt -tgt tgt-test.txt -res result_file
If you find our code or paper useful to your research, please kindly cite our paper.
@inproceedings{chen-etal-2019-ensuring,
title = "Ensuring Readability and Data-fidelity using Head-modifier Templates in Deep Type Description Generation",
author = "Chen, Jiangjie and
Wang, Ao and
Jiang, Haiyun and
Feng, Suo and
Li, Chenguang and
Xiao, Yanghua",
booktitle = "Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics",
month = jul,
year = "2019",
address = "Florence, Italy",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/P19-1196",
doi = "10.18653/v1/P19-1196",
pages = "2036--2046",
}