| Application Programming Interface(API)can effectively help programmers to reuse software and quickly complete programming,However,due to its wide variety and complex usage specifications,it is challenging for programmers to learn how to use APIs correctly.API recommendation tools can help programmers use APIs by recommending which APIs to be used next given the APIs that have been written.Traditional API recommendation methods usually use probabilistic models or data mining algorithms to learn or mine API usage patterns.However,due to the continuous changes of software libraries and the continuous emergence of new libraries,the number of new APIs continues to increase.These new APIs are often regarded as OOV(unknown words)words,and due to lack of training data,the existing API recommendation methods cannot handle these APIs well,thereby reducing their recommendation performance.In order to alleviate the OOV problem in API recommendation,In this paper,we propose APIRec X,the first cross-library API recommendation approach,which uses BPE to split each API call in each API sequence and pre-trains a GPT-based language model.Finally,by fine-tuning the pre-trained model on the small-scale target library API data,APIRec X can be used to recommend APIs combined with a beam search-based API synthesis technology.APIRec X can migrate the knowledge of API usage patterns learned from the existing library to the new library,and can correctly recommend APIs that are regarded as OOV words by traditional API recommendation tools.Our work evaluates APIRec X on six target API libraries(API libraries java.sql,javax.sql for database-related operations,API libraries java.awt,javax.swing,for building graphical interfaces and API libraries java.io,java.nio for data writing and output)and compares it with LSTM-based and n-gram-based API recommendation methods The result shows that:In the absence of training data,APIRec X has improved the Top-1 accuracy by42.54%-72.87% and 216.46%-221.0% compared with LSTM-based and n-gram-based methods,respectively. |