Skip to main content

Multi-modal Code Summarization Fusing Local API Dependency Graph and AST

  • Conference paper
  • First Online:
Neural Information Processing (ICONIP 2021)

Part of the book series: Communications in Computer and Information Science ((CCIS,volume 1516))

Included in the following conference series:

Abstract

Automatically obtaining descriptions of the functions of code snippets in natural language, i.e., code summarization, is an important issue in software engineering. In recent years, abstract syntax tree (AST)-based code summarization models for modelling syntactic structures have continued to emerge. In addition to syntactics, the semantics of the code are gradually gaining attention. In this paper, we propose a code summarization approach that incorporates local-ADG and AST, called GTsum. In particular, we introduce a novel local-ADG-based approach that can effectively filter out irrelevant semantics in the modelling of the semantic structure of code. GTsum learns semantics and syntactics in the local-ADG and AST through graph convolutional networks (GCNs) and then fuses them using Transformer. We evaluate our model on two Java language datasets with several metrics. The results demonstrate that our model achieves state-of-the-art performance compared to the existing models.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 99.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 129.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    https://github.com/flairNLP/flair.

References

  1. Chen, M., Wan, X.: Neural comment generation for source code with auxiliary code classification task. In: Asia-Pacific Software Engineering Conference, APSEC, pp. 522–529 (2019)

    Google Scholar 

  2. Hu, X., Li, G., Xia, X., Lo, D., Jin, Z.: Deep code comment generation. In: 2018 IEEE/ACM 26th International Conference on Program Comprehension (ICPC), pp. 200–210 (2018)

    Google Scholar 

  3. Lyu, C., Wang, R., Zhang, H., Zhang, H., Hu, S.: Embedding API dependency graph for neural code generation. Empir. Softw. Eng. 26(4), 1–51 (2021)

    Article  Google Scholar 

  4. Iyer, S., Konstas, I., Cheung, A., Zettlemoyer, L.: Summarizing source code using a neural attention model. In: Association for Computational Linguistics, pp. 2073–2083 (2016)

    Google Scholar 

  5. Xu, K., Wu, L., Wang, Z., Feng, Y., Sheinin, V.: Sql-to-text generation with graph-to-sequence model. In: Association for Computational Linguistics (2014)

    Google Scholar 

  6. Hu, X., Li, G., Xia, X., Lo, D., Lu, S., Jin, Z.: Summarizing source code with transferred api knowledge. In: International Joint Conference on Artificial Intelligence (IJCAI), pp. 802–810 (2018)

    Google Scholar 

  7. Wang, W., et al.: Reinforcement-learning-guided source code summarization via hierarchical attention. IEEE Trans. Softw. Eng. (2020)

    Google Scholar 

  8. Allamanis, M., Peng, H., Sutton, C.: A convolutional attention network for extreme summarization of source code. In: International Conference on Machine Learning (ICML), vol. 48, pp. 2091–2100 (2016)

    Google Scholar 

  9. Ling, W., et al.: Latent predictor networks for code generation (2016)

    Google Scholar 

  10. Papineni, K., Roukos, S., Ward, T., Zhu, W.J.: Bleu: a method for automatic evaluation of machine translation. In: Association for Computational Linguistics, pp. 311–318 (2002)

    Google Scholar 

  11. Banerjeee, S., Lavie, A.: METEOR: an automatic metric for MT evaluation with improved correlation with human judgments. In: Association for Computational Linguistics, pp. 65–72 (2005)

    Google Scholar 

  12. Lin, C.Y.: Rouge: a package for automatic evaluation of summaries. In: Text Summarization Branches, pp. 74–81 (2004)

    Google Scholar 

  13. LeClair, A., Jiang, S., McMillan, C.: A neural model for generating natural language summaries of program subroutines. In: International Conference on Software Engineering (ICSE), pp. 795–806 (2019)

    Google Scholar 

Download references

Acknowledgments

This work is financially supported by the National Natural Science Foundation of China (61602286, 61976127) and the Special Project on Innovative Methods (2020IM020100).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Chen Lyu .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2021 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Gao, X., Jiang, X., Wu, Q., Wang, X., Lyu, C., Lyu, L. (2021). Multi-modal Code Summarization Fusing Local API Dependency Graph and AST. In: Mantoro, T., Lee, M., Ayu, M.A., Wong, K.W., Hidayanto, A.N. (eds) Neural Information Processing. ICONIP 2021. Communications in Computer and Information Science, vol 1516. Springer, Cham. https://doi.org/10.1007/978-3-030-92307-5_34

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-92307-5_34

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-92306-8

  • Online ISBN: 978-3-030-92307-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics