Skip to content

panthap2/LearningToUpdateNLComments

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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 = {1853–1868},
  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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages