Automatic Comment Generation for Source Code Using External Information by Neural Networks for Computational Thinking

  • Hiromitsu Shiina Okayama University of Science
  • Sakuei Onishi Okayama University of Science
  • Akiyoshi Takahashi Icom Sytech
  • Nobuyuki Kobayashi Sanyo Gakuen University
Keywords: Programming learning, Comment Generating, Encoder–Decoder Translation Model, TF–IDF, Distributed Representation

Abstract

To support the understanding of programs and understanding of procedures, we think need to automatically generate comments from source code. As a method, we learn the source code and comment pair by Encoder–Decoder translation model using LSTM, thereby generating comments of the source code that was the target of learning. In the Encoder–Decoder translation model, the source code of a program and its pair of comments are learned. However, that method does not know the domain of the program being used, so the comments that can be generated automatically may not be appropriate. In the use of learning, such as programs and algorithms for the purpose of computational thinking, it is possible to obtain relate information, such as problem statements and explanations. Therefore, we propose some methods to improve generated comments by using relate external information, such as question sentences. Also, we generate comments for each line and each block.

References

Ministry of Education, Culture, Sports, Science and Technology, “Elementary school programming education guide (2nd edition),” 2018. [Online] Available: http://www.mext.go.jp/a_menu/shotou/zyouhou/detail/1403162.htm, [Accessed May. 5, 2020] (in Japanse).

Ministry of Education, Culture, Sports, Science and Technology. “How to programming education at elementary school level (Summary of discussion).” 2016. [Online] Available: http://www.mext.go.jp/b_menu/shingi/chousa/shotou/122/attach/1372525.htm , [Accessed May. 5, 2029] (In Japanese).

H. Kanamori, T. Tomoto and T. Akakura, “Development of a Computer Programming Learning Support System Based on Reading Computer Program,” Human Interface and the Management of Information. Information and Interaction for Learning, Culture, Collaboration and Business (HIMI) 2013, pp. 63-69, Springer, 2013. DOI:10.1007/978-3-642-39226-9_8

K. Okimoto, S. Matsumoto, S. Yamagishi and T. Kashima, “Developing a source code reading tutorial system and analyzing its learning log data with multiple classification analysis,” Artificial Life and Robotics, Vol 22, No. 7, pp. 227-237, 2017. DOI:10.1007/s10015-017-0357-2

S. Matsumoto, K. Okimoto, T. Kashima and S. Yamagishi, “Automatic Generation of C Source Code for Novice Programming Education, Human-Computer Interaction,” Theory, Design, Development and Practice 2016, pp. 65-76, 2016. DOI:10.1007/978-3-319-39510-4_7

S. Matsumoto, Y. Hayashi, T. Hirashima, “Development of a Card Operation-Based Programming Learning Sytem Focusing on Thinking between the Relations of Parts,” IEEJ, Transaction on Electronics, Information and Systems, Vol. 138, No.8, pp.999-1010, 2018. (in Japanese)

J. Shinkai, Y. Hayase, I. Miyaji, “A Trial of Algorithm Education Emphasizing Manual Procedures,” In Proc. Society for Information Technology & Teacher Education International Conference 2016, pp. 113-118, 2016. (in Japanese)

I. Sutskever, O. Vinyals and Q. Le, “Sequence to Sequence Learning with Neural Networks,” Advances in Neural Information Processing Systems 27 (NIPS 2014), pp. 3104-3112, 2014.

M. Luong, H. Pham and D. Manning, “Effective Approaches to Attention-based Neural Machine Translation,” arXiv preprint arXiv:1508.04025v5, 2015.

A. Rush, S. Chopra and C. Weston, “A Neural Attention Model for Sentence Summarization,” In Proc. EMNLP 2015: Conference on Empirical Methods in Natural Language Processing, pp. 379-389, 2015.

K. Greff, et al., “LSTM: A Search Space Odyssey,” IEEE Transactions on Neural Networks and Learning Systems, Vol. 28, Issue10, pp. 2222-2232, 2017.

T. Mikolov, et al., “Efficient estimation of word representations in vector space,”, arXiv preprint arXiv:1301.3781, pp. 1–12, 2013.

A. Takahashi, H. Shiina, N. Kobayashi, “Comment Generation System for ProgramProcedure Learning”, In Proc. International Conference on Advanced Applied Informatics 2018, pp.38–42, 2018.

X. Hu, G. Li, D. Lo, Z. Jin, “Deep Code Comment Generation,” IN Proc. ICPC ’18, pp. 200–210, 2018.

K. Papineni, S. Roukos, T. Ward, W. Zhu, “BLEU: amethod for Automatic Evaluation of Machine Translation”, In Proc. 40th Annual Meeting of the Association for Computational Linguistics, pp. 311318, 2002.

K. Sakane, N. Kobayashi, H. Shiina and F. Kitagawa, “Kanji Learning and Programming Support System which conjoined with a Lecture,” IEICE Technical Report, ET2014–86, Vol. 114, No. 513, pp. 7–12, 2015.

Published
2021-01-18