rcshubhadeep / LearningToUpdateNLComments

Learning to Update Natural Language Comments Based on Code Changes: Artifact

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Learning to Update Natural Language Comments Based on Code Changes

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 = {To appear},
  year = {2020},
}

Download generation and update data from here.

  1. Create a directory named generation-models in the root directory
mkdir generation-models
  1. 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
  1. 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
  1. Create a direction named embeddings in the root directory
mkdir embeddings
  1. 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
  1. Create a directory named update-models in the root directory
mkdir update-models
  1. Download resources folder from here, and move it to the root directory.
  2. 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
  1. 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

About

Learning to Update Natural Language Comments Based on Code Changes: Artifact

License:MIT License


Languages

Language:Python 100.0%