CORTEXA
← Browse
openalexAin Shams Engineering Journal2026-07-25

An API recommendation method fusing context and semantic

Shi Cheng, Zihan Zhu, Yifei Shao, Jinfeng He, Zelin Wang

In modern software development, API recommendation systems play a crucial role in enhancing development efficiency. Query-based API recommendation better aligns with developers’ actual needs because developers often express programming tasks through natural-language queries and partial code contexts. However, traditional methods relying mainly on keyword matching or static code analysis struggle to jointly capture query semantics and programming context, which may lead to inaccurate or poorly ranked recommendations. To address this problem, we propose the Context-enhanced Query-based API Recommendation Approach (CQARA). CQARA enriches query expressions through synonym substitution, constructs a multidimensional query-context-API triplet tensor, applies non-negative tensor factorization to recover latent associations under sparse observations, and uses the BLAST algorithm for local context-sequence matching and API re-ranking. Experiments on real-world datasets show that CQARA consistently improves class-level and method-level API recommendation performance over representative baselines across SuccessRate, Recall, MAP, MRR, and NDCG.