The invention particularly relates to an API recommendation method based on
natural language query. The API recommendation method based on
natural language query comprises the following steps:
crawling a
Java open source project on a code hosting platform Githhub by using a Scrapy crawler framework, and obtaining information of each storage
library; selecting an API
library as a target
library in a user-defined manner, analyzing and extracting the
source code by using a code analysis tool, and obtaining API method calling information of the target library; s2, randomly selecting
metadata from all the
metadata obtained in the step S2 as a
data set, performing clustering analysis on the
data set by using a
hierarchical clustering algorithm, and mining an API use mode from the
data set; and performing API recommendation according to the API use mode. According to the API recommendation method based on
natural language query, analysis and mode mining are performed on large-scale codes, API recommendation can be performed according to the input natural language text described by the function, the accuracy of recommending related APIs is improved, the
workload of searching and selecting the APIs by developers is reduced, and the efficiency of
software development is improved.