Abstract
To satisfy business requirements of various platforms and devices, developers often need to migrate software code from one platform to another. During this process, a key task is to figure out API mappings between API libraries of the source and target platforms. Since doing it manually is time-consuming and error-prone, several code-based approaches have been proposed. However, they often have the issues of availability on parallel code bases and time expense caused by static or dynamic code analysis.
In this paper, we present a document-based approach to infer API mappings. We first learn to understand the semantics of API names and descriptions in API documents by a word embedding model. Then we combine the word embeddings with a text similarity algorithm to compute semantic similarities between APIs of the source and target API libraries. Finally, we infer API mappings from the ranking results of API similarities. Our approach is evaluated on API documents of JavaSE and .NET. The results outperform the baseline model at precision@k by 41.51% averagely. Compared with code-based work, our approach avoids their issues and leverages easily acquired API documents to infer API mappings effectively.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
References
Gokhale, A., Ganapathy, V., Padmanaban, Y.: Inferring likely mappings between APIs. In: 2013 35th International Conference on Software Engineering (ICSE), pp. 82–91. IEEE (2013)
Mihalcea, R., Corley, C., Strapparava, C., et al.: Corpus-based and knowledge-based measures of text semantic similarity. In: AAAI, vol. 6, pp. 775–780 (2006)
Mikolov, T., Sutskever, I., Chen, K., Corrado, G.S., Dean, J.: Distributed representations of words and phrases and their compositionality. In: Advances in Neural Information Processing Systems, pp. 3111–3119 (2013)
Nguyen, A.T., Nguyen, H.A., Nguyen, T.T., Nguyen, T.N.: Statistical learning approach for mining API usage mappings for code migration. In: Proceedings of the 29th ACM/IEEE International Conference on Automated Software Engineering, pp. 457–468. ACM (2014)
Nguyen, A.T., Nguyen, H.A., Nguyen, T.T., Nguyen, T.N.: Statistical learning of API mappings for language migration. In: Companion Proceedings of the 36th International Conference on Software Engineering, pp. 618–619. ACM (2014)
Nguyen, A.T., Nguyen, T.T., Nguyen, T.N.: Migrating code with statistical machine translation. In: Companion Proceedings of the 36th International Conference on Software Engineering, pp. 544–547. ACM (2014)
Nguyen, T.D., Nguyen, A.T., Nguyen, T.N.: Mapping API elements for code migration with vector representations. In: Proceedings of the 38th International Conference on Software Engineering Companion, pp. 756–758. ACM (2016)
Nguyen, T.D., Nguyen, A.T., Phan, H.D., Nguyen, T.N.: Exploring API embedding for API usages and applications. In: Proceedings of the 39th International Conference on Software Engineering. ACM (2017)
Thung, F., David, L., Lawall, J.: Automated library recommendation. In: Proceedings of the 2013 20th Working Conference on Reverse Engineering (WCRE 2013), Koblenz, Germany, 14–17 October 2013, pp. 182–191 (2013)
Zhong, H., Thummalapenta, S., Xie, T., Zhang, L., Wang, Q.: Mining API mapping for language migration. In: Proceedings of the 32nd ACM/IEEE International Conference on Software Engineering, vol. 1, pp. 195–204. ACM (2010)
Acknowledgement
This research is supported by the National Basic Research Program of China (the 973 Program) under Grant No. 2015CB352201 and the National Natural Science Foundation of China under Grant Nos. 61421091, 61232015 and 61502014.
Author information
Authors and Affiliations
Corresponding authors
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2017 Springer International Publishing AG
About this paper
Cite this paper
Lu, Y., Li, G., Zhao, Z., Wen, L., Jin, Z. (2017). Learning to Infer API Mappings from API Documents. In: Li, G., Ge, Y., Zhang, Z., Jin, Z., Blumenstein, M. (eds) Knowledge Science, Engineering and Management. KSEM 2017. Lecture Notes in Computer Science(), vol 10412. Springer, Cham. https://doi.org/10.1007/978-3-319-63558-3_20
Download citation
DOI: https://doi.org/10.1007/978-3-319-63558-3_20
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-63557-6
Online ISBN: 978-3-319-63558-3
eBook Packages: Computer ScienceComputer Science (R0)