计算机应用 ›› 2017, Vol. 37 ›› Issue (10): 2958-2963.DOI: 10.11772/j.issn.1001-9081.2017.10.2958
收稿日期:
2017-04-21
修回日期:
2017-06-09
出版日期:
2017-10-10
发布日期:
2017-10-16
通讯作者:
顾逸圣(1992-),男,上海人,硕士研究生,主要研究方向:软件工程、代码搜索,E-mail:qswy929@163.com
作者简介:
顾逸圣(1992-),男,上海人,硕士研究生,主要研究方向:软件工程、代码搜索;曾国荪(1964-),男,江西吉安人,教授,博士,博士生导师,主要研究方向:并行计算、可信软件、信息安全.
基金资助:
GU Yisheng1,2, ZENG Guosun1
Received:
2017-04-21
Revised:
2017-06-09
Online:
2017-10-10
Published:
2017-10-16
Supported by:
摘要: 针对在编写软件、复用源代码的过程中仅依靠关键词无法精准搜索到适用源代码的问题,提出一种将语法和语义结合的源代码精准搜索方法。首先依据源代码语法语义的客观和唯一性,增加语法结构和"输入/输出"语义作为用户录入请求的一部分,并规范了具体的请求格式;然后在此基础上分别设计源代码语法匹配算法、"输入/输出"语义匹配算法、关键词兼容匹配,以及源代码搜索结果可信度计算算法;最后综合上述算法实现对源代码的精准搜索。测试结果表明:与单纯的关键词搜索相比,提出的方法对搜索的平均排序倒数(MRR)有超过62%的提升,有助于实现源代码的精准搜索。
中图分类号:
顾逸圣, 曾国荪. 基于语法和语义结合的源代码精确搜索方法[J]. 计算机应用, 2017, 37(10): 2958-2963.
GU Yisheng, ZENG Guosun. Accurate search method for source code by combining syntactic and semantic queries[J]. Journal of Computer Applications, 2017, 37(10): 2958-2963.
[1] BAJRACHARYA S, NGO T, LINSTEAD E, et al. Sourcerer: a search engine for open source code supporting structure-based search [C]//OOPSLA 2006: Companion To the 21st ACM SIGPLAN Symposium on Object-Oriented Programming Systems, Languages, and Applications. New York: ACM, 2006: 681-682. [2] FARAH G, TEJADA J S, CORREAL D. OpenHub: a scalable architecture for the analysis of software quality attributes [C]//MSR 2014: Proceedings of the 11th Working Conference on Mining Software Repositories. New York: ACM, 2014: 420-423. [3] PAUL S, PRAKASH A. A framework for source code search using program patterns[J]. IEEE Transactions on Software Engineering, 1994, 20(6): 463-475. [4] HILL E, POLLOCK L, VIJAY-SHANKER K. Improving source code search with natural language phrasal representations of method signatures [C]//ASE 2011: Proceedings of the 2011 26th IEEE/ACM International Conference on Automated Software Engineering. Washington, DC: IEEE Computer Society, 2011: 524-527. [5] 胡翔, 舒礼莲. 基于语义网络的海量源代码搜索引擎[J]. 计算机与现代化, 2014, 30(7): 19-23. (HU X, SHU L L. Search engine of massive source code based on semantic network[J]. Computer and Modernization, 2014, 30(7): 19-23.) [6] 孟骁. 基于语义网络的智能搜索引擎研究[D]. 长春: 东北师范大学, 2011. (MENG X. Research of intelligent search engine based on semantic Web[D]. Changchun: Northeast Normal University, 2011.) [7] 刘石, 李合, 王啸吟, 等. 基于语法与语义分析的代码搜索结果优化[J]. 计算机科学, 2009, 32(8): 165-168. (LIU S, LI H, WANG X Y, et al. Enhancement of code search results using syntax and semantic analysis[J]. Computer Science, 2009, 32(8): 165-168.) [8] KEIVANLOO I, ROOSTAPOUR L, SCHUGERL P, et al. SE-CodeSearch: a scalable semantic Web-based source code search infrastructure [C]//ICSM 2010: Proceedings of the 2010 26th IEEE International Conference on Software Maintenance. Piscataway, NJ: IEEE, 2010: 1-5. [9] STOLEE K T, ELBAUM S, DOBOS D. Solving the search for source code[J]. ACM Transactions on Software Engineering and Methodology, 2014, 23(3): 26-26. [10] STOLEE K T, ELBAUM S, DWYER M B, et al. Code search with input/output queries: generalizing, ranking, and assessment[J]. Journal of Systems and Software, 2016, 116(6): 35-48. [11] 满海霞, 梁雅梦. 乔姆斯基层级与自然语言语法——从短语结构语法到非转换语法[J]. 外国语文, 2015, 31(3): 84-89. (MAN H X, LIANG Y M. Chomsky hierarchy and natural language grammars: from phrase structure grammar to non-transformational grammar[J]. Foreign Language and Literature, 2015, 31(3): 84-89.) [12] 陈火旺. 程序设计语言编译原理[M]. 北京: 国防工业出版社, 2000. (CHEN H W. Programming Language and Compile Principles[M]. Beijing: National Defense Industry Press, 2000.) [13] RAJESHWARKAR A, NAGORI M. Optimizing search results using Wikipedia based ESS and enhanced TF-IDF approach[J]. International Journal of Computer Applications, 2016, 144(12): 23-28. [14] FREITAS A, OLIVEIRA J G, ORIAIN S, et al. Querying linked data using semantic relatedness: a vocabulary independent approach [C]//NLDB 2011: Proceedings of the 16th International Conference on Application of Natural Language to Information Systems. Berlin: Springer, 2011: 40-51. |
[1] | 郭一阳 于炯 杜旭升 杨少智 曹铭. 基于自编码器与集成学习的离群点检测算法[J]. 计算机应用, 0, (): 0-0. |
[2] | 赵全, 汤小春, 朱紫钰, 毛安琪, 李战怀. 大规模短时间任务的低延迟集群调度框架[J]. 计算机应用, 2021, 41(8): 2396-2405. |
[3] | 冯钧 王秉发 陆佳民. 分布式资源描述框架数据管理系统查询性能评价[J]. 计算机应用, 0, (): 0-0. |
[4] | 李国荣, 冶继民, 甄远婷. 基于新的鲁棒相似性度量的时间序列聚类[J]. 计算机应用, 2021, 41(5): 1343-1347. |
[5] | 王治和, 常筱卿, 杜辉. 基于万有引力的自适应近邻传播聚类算法[J]. 计算机应用, 2021, 41(5): 1337-1342. |
[6] | 林定康 颜嘉麒 巴·楠登 符朕皓 姜皓晨. 门罗币匿名及追踪技术综述[J]. 计算机应用, 0, (): 0-0. |
[7] | 沈忱, 邰凌翔, 彭煜玮. 面向自动参数调优的动态负载匹配方法[J]. 计算机应用, 2021, 41(3): 657-661. |
[8] | 张效伟, 江大伟, 陈珂, 陈刚. 关系数据库中聚合代数约束的高效发现算法——AAC-Hunter[J]. 计算机应用, 2021, 41(3): 636-642. |
[9] | 陈锦宇, 刘兆伟. 基于改进投票证明共识协议的车联网系统[J]. 计算机应用, 2021, 41(1): 170-176. |
[10] | 毛昕怡, 钮俊, 丁雪儿, 张开乐. 基于模型检测的微服务组合平台QoS验证[J]. 计算机应用, 2020, 40(11): 3267-3272. |
[11] | 杨程, 陆佳民, 冯钧. 分布式环境下大规模资源描述框架数据划分方法综述[J]. 计算机应用, 2020, 40(11): 3184-3191. |
[12] | 赵川, 苗丽叶, 杨浩雄, 何明珂. 随机需求下双渠道供应链库存动态交互优化[J]. 计算机应用, 2020, 40(9): 2754-2761. |
[13] | 吴芷菡, 崔喆, 刘霆, 蒲泓全. 基于区块链的安全电子选举方案[J]. 计算机应用, 2020, 40(7): 1989-1995. |
[14] | 杜旭升, 于炯, 叶乐乐, 陈嘉颖. 基于图上随机游走的离群点检测算法[J]. 计算机应用, 2020, 40(5): 1322-1328. |
[15] | 罗际炜, 瞿涛, 邓徳祥. 嵌入式多通道无线视频传输的码率自适应算法[J]. 计算机应用, 2020, 40(4): 1119-1126. |
阅读次数 | ||||||
全文 |
|
|||||
摘要 |
|
|||||