Code and datasets for our ACL-2020 paper "Learning to Update Natural Language Comments Based on Code Changes" which can be found here.
If you find this work useful, please consider citing our paper:
@inproceedings{PanthaplackelETAL20CommentUpdate,
author = {Panthaplackel, Sheena and Nie, Pengyu and Gligoric, Milos and Li, Junyi Jessy and Mooney, Raymond J.},
title = {Learning to Update Natural Language Comments Based on Code Changes},
booktitle = {Association for Computational Linguistics},
pages = {1853–1868},
year = {2020},
}
Download generation and update data from here.
- Create a directory named
generation-models
in the root directory
mkdir generation-models
- Train the comment generation model:
python3 comment_generation.py -data_path public_comment_update_data/full_comment_generation/ -model_path generation-models/model.pkl.gz
- Evaluate the comment generation model:
python3 comment_generation.py -data_path public_comment_update_data/full_comment_generation/ -model_path generation-models/model.pkl.gz --test_mode
- Create a direction named
embeddings
in the root directory
mkdir embeddings
- Save pre-trained embeddings from the comment generation model to disk:
python3 comment_generation.py -data_path public_comment_update_data/full_comment_generation/ -model_path generation-models/model.pkl.gz --test_mode --get_embeddings
- Create a directory named
update-models
in the root directory
mkdir update-models
- Download
resources
folder from here, and move it to the root directory. - Train the comment update model (i.e., edit model):
python3 comment_update.py -data_path public_comment_update_data/comment_update/ -model_path update-models/model.pkl.gz
- Evaluate the comment update model (i.e., edit model):
python3 comment_update.py -data_path public_comment_update_data/comment_update/ -model_path update-models/model.pkl.gz --test_mode --rerank