文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > 计算机软件及应用 > SOURCE CODE RETRIEVAL USING SEQUENCE BASED SIMILARITY
侵权投诉

SOURCE CODE RETRIEVAL USING SEQUENCE BASED SIMILARITY

set of method-level metrics including McCabe’s cyclomatic complexity [14], and a characteristic vector to approximate the structural information in ASTs [6].

Our approach is classified as a structure-based comparison. It features a sequence of statements as a retrieval condition. We have developed a lexical parser to extract source code structure, including control statements and method identifiers. The extracted structural information is input to a vector space model [1,12,17], an extended Sorensen-Dice model [4,16,19], and the proposed source code retrieval model, named the “derived sequence retrieval model” (DSRM). The DSRM takes a sequence of statements as a retrieval condition and derives meaningful search conditions from the given sequence. Because a program is composed of a sequence of statements, our retrieval model improves the performance of source code retrieval.

The remainder of this paper is organized as follows. In Section 2, we present an outline of the process and the target source code of our research. In Section 3, we define source code similarity metrics. Retrieval results are discussed in Section 4. In Section 5, we analyze performance in elapsed time, and Section 6 presents conclusions and suggestions for future work.

2. RESEARCH PROCESS

2.1. Outline

Figure 1 shows an outline of our research process. Generally, similarity retrieval of source code is performed for a specific purpose. From this perspective, the original source code may include some uninteresting fragments. We have developed a lexical parser and applied it to a set of original Java source codes to extract interesting code, which includes class method signatures, control statements, and method calls. Our parser traces a variable type declaration and class instantiation to generate an identifier-type list. This list is then used to translate a variable identifier to its data type. A method call preceded by an identifier is converted into the method calls preceded by the data type of the identifier.

Code matching is performed using three retrieval models. The first model is the proposed DSRM, which takes a sequence of statements as a retrieval condition. The second model is based on the collection of statements, and is referred to as the derived collection retrieval model (DCRM). The DCRM is an extension of the Sorensen-Dice model of index [4,16,19]. The final retrieval model is the vector space model (VSM) [1,12,17], which has been developed to retrieve a natural language document. Source code can be perceived as a highly structured document; therefore, comparison with DSRM, DCRM, and VSM provides a baseline performance evaluation of how structure of a document will affect retrieval results.

59

上一页第3页

你可能喜欢

热门文档

相关文档

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email