Code for the model presented in the paper: "Keywords Guided Method Name Generation". This repository contains the Tensorflow implementation of Keywords Extractor and KG-MNGen, the code implementation are based on graph neural network library OpenGNN.
The dataset we used is from paper "Code2seq: Generating Sequences from Structure Representations of Code", where the unprocessed Java-small dataset can be found and downloaded Here. You can parse the original dataset to the graph format by Parsers.
To download the preprocessed datasets for Keywords Extractor and KG-MNGen, use:
First, you should train the keywords extractor. Note that the param --classify is needed.
sh run_extractor.sh
Then, run the keywords extractor to predict the keywords of each code snippet.
sh infer_extractor.sh
Of course, you can download the processed method name generation dataset, instead of retraining a keywords extractor.
Similar to the keywords extractor, train the KG-MNGen first.
sh run_kgmngen.sh
Then, run the KG-MNGen to predict the method name of each code snippet.
sh infer_kgmngen.sh