Reproducability package for ICSE 2019

A Neural Model for Generating Natural Language Summaries of Program Subroutines

Download Link

Click the link to download the compressed package. The base directory contains a README file explaining how to run the experiments outlined in the paper.


to train a model, go into funcom/standard or funcom/challenge and use train.py.

example train: python3 train.py --model-type attend-gru --gpu 0


to predict on a trained model call predict.py in funcom/standard or funcom/challenge

example predict: python3 predict.py ./outdir/astattendgru.h5 --gpu 0


to calculate bleu score for a given prediction call bleu.py funcom/standard or funcom/challenge and pass in the predict txt file

example bleu score: python3 bleu.py ./outdir/predict-astattendgru.h5.txt

Path Filename Note
funcom/data/standard/ dataset.pkl processed dataset sequences for the standard experiment
funcom/data/standard/ coms.tok/dats.tok/smls.tok tokenizer objects to go from text to sequence or sequence to text
funcom/data/standard/output dataset.coms/dataset.dats/dataset.srcml text files containing preprocessed data
funcom/data/standard/output coms.train/val/test dats.train/val/test smls.train/val/test text files split into training, validation, and test sets
funcom/data/sbt/ dataset.pkl processed dataset sequences for the sbt experiment
funcom/data/sbt/ coms.tok/dats.tok/smls.tok tokenizer objects to go from text to sequence or sequence to text
funcom/data/sbt/output dataset.coms/dataset.dats/dataset.srcml text files containing preprocessed data
funcom/data/sbt/output coms.train/val/test dats.train/val/test smls.train/val/test text files split into training, validation, and test sets
funcom/standard train.py file to train a model using the standard datasets
funcom/standard predict.py predict using a trained model
funcom/standard predict_dual.py predict with ensemble of two models using sum of softmax outputs
funcom/standard bleu.py calculate bleu score for a given prediction file
funcom/standard model.py helper class for model selection used by train.py and predict.py
funcom/standard myutils.py helper functions/classes used in training and predictions
funcom/challenge train.py file to train a model using the challenge datasets
funcom/challenge predict.py predict using a trained model
funcom/challenge predict_dual.py predict with ensemble of two models using sum of softmax outputs
funcom/challenge bleu.py calculate bleu score for a given prediction file
funcom/challenge model.py helper class for model selection used by train.py and predict.py
funcom/challenge myutils.py helper functions/classes used in training and predictions
Path Trained Model Note
funcom/standard/outdir standard_attend-gru_E04_TA0.72_VA0.66.h5 attend GRU model trained on the standard dataset
funcom/standard/outdir standard_xtra_E05_TA0.74VA0.66.h5 ast-attendgru model trained on standard dataset
funcom/standard/outdir sbt_attend-gru_E04_TA0.68_VA0.63.h5 sbt model trained on standard dataset
funcom/challenge/outdir xtra_E03_TA0.63_VA0.60.h5 ast-attendgru model trained on the challenge set