paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Statistical learning of API fully qualified names in code snippets of online forums

在线论坛代码片段中 API 完全限定名的统计学习
ICSE Proceedings of the 40th International Conference on Software Engineering2018匹配度 3/10 · 该论文属于机器学习与程序语言/代码分析交叉,但核心是解析论坛代码片段中的 API 完全限定名,未涉及 LLM/Agent、面向 ML 系统的静态分析、浮点程序分析或贝叶斯程序分析,与当前研究画像核心方向较远。引用 48 inbox
Hung Phan, Hoan Anh Nguyen, Ngoc M. Tran, Linh H. Truong, Anh Tuan Nguyen, Tien N. Nguyen
crossref: 2026-09-12

AI 速览

一句话:提出 StatType,用统计机器翻译与共现知识为论坛代码片段中的 API 推断完全限定名。

论文关注 StackOverflow 等在线论坛代码片段中外部 API 引用常未声明、有歧义或未完全限定,导致开发者难以正确学习和使用 API 的问题。作者提出 StatType,一种统计方法,为片段中的 API 元素解析完全限定名(FQN)。方法包含两个整合因素:从大规模训练代码语料学习经常共现的 FQN,并利用目标 API 名称的邻居 API 名称构成上下文;并将任务建模为从“部分限定名的源代码”到“带 FQN 的源代码”的统计机器翻译。在真实代码和 StackOverflow 帖子上的评估表明,StatType 达到 97.6% 精确率和 96.7% 召回率,相对当前最优方法提升 16.5%。

问题
在线论坛代码片段中的 API 引用常缺少声明、存在歧义或未完全限定,开发者需要推断其完全限定名才能正确使用 API。
方法
StatType 从大规模代码语料学习 FQN 共现知识,并结合邻居 API 名称构成的上下文,将部分限定名代码到完全限定名代码的转换视为统计机器翻译。
评估
在真实代码与 StackOverflow 帖子上进行评估,StatType 取得 97.6% 精确率和 96.7% 召回率,相对当前最优方法相对提升 16.5%。
原文摘要(Abstract)

Software developers often make use of the online forums such as StackOverflow (SO) to learn how to use software libraries and their APIs. However, the code snippets in such a forum often contain undeclared, ambiguous, or largely unqualified external references. Such declaration ambiguity and external reference ambiguity present challenges for developers in learning to correctly use the APIs. In this paper, we propose StatType, a statistical approach to resolve the fully qualified names (FQNs) for the API elements in such code snippets. Unlike existing approaches that are based on heuristics, StatType has two well-integrated factors. We first learn from a large training code corpus the FQNs that often co-occur. Then, to derive the FQN for an API name in a code snippet, we use that knowledge and also leverage the context consisting of neighboring API names. To realize those factors, we treat the problem as statistical machine translation from source code with partially qualified names to source code with FQNs of the APIs. Our empirical evaluation on real-world code and StackOverflow posts shows that StatType achieves very high accuracy with 97.6% precision and 96.7% recall, which is 16.5% relatively higher than the state-of-the-art approach.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot4407,
  title = {Statistical learning of API fully qualified names in code snippets of online forums},
  author = {Hung Phan and Hoan Anh Nguyen and Ngoc M. Tran and Linh H. Truong and Anh Tuan Nguyen and Tien N. Nguyen},
  booktitle = {ICSE},
  year = {2018},
  doi = {10.1145/3180155.3180230}
}