We propose a framework to automatically generate descriptive comments for source code blocks.While this problem has been studied by many researchers previously,their methods are mostly based on fixed template or just use the LSTM to handle the source code like plain text.These models achieved poor results.Our framework does not rely on any template,but makes use of a new recursive neural network called CodeRNN that is based on the parse tree of source codes to extract features from the source code and embed them into one vector.When this vector representation is input to a new recurrent neural network(Code-GRU),the overall framework generates text descriptions of the code with accuracy(Rouge-2 value)significantly higher than other learningbased approaches such as sequence-to-sequence model.We add a new structure called choose gate in the Code-GRU to hanld the information that is embedded in the representation vector.The Code-RNN model can also be used in other scenario where the representation of code is required. |