기본 정보
- 저자
- DOI
- 10.48550/arxiv.1711.04705
- 저널
- arXiv (Cornell University)
- 발행년도
- 2022
- 발행기관
- Cornell University
- 피인용수
- 0
- 라이선스
- 0
- 논문 유형
- –
- 언어
- –
- 원문 페이지
- https://doi.org/10.48550/arxiv.1711.04705
- 토픽
- Nanomaterials and Printing Technologies
- OpenAlex ID
- W6929019390
평가 내용
- 관련도
- 사업분야
- 필름·전자재료 · (13) 프리즘 필름
- 부 분야
- –
- R&D 측면
- –
- 확신도
- –
- 근거 용어
- –
- 판단 근거
- 임베딩 유사도 기반 평가로 '필름·전자재료 > 프리즘 필름' 분야에 선정된 논문입니다.
- R&D 활용 포인트
- –
- 평가 입력
- –
초록
Contemporary software documentation is as complicated as the software itself. During its lifecycle, the documentation accumulates a lot of near duplicate fragments, i.e. chunks of text that were copied from a single source and were later modified in different ways. Such near duplicates decrease documentation quality and thus hamper its further utilization. At the same time, they are hard to detect manually due to their fuzzy nature. In this paper we give a formal definition of near duplicates and present an algorithm for their detection in software documents. This algorithm is based on the exact software clone detection approach: the software clone detection tool Clone Miner was adapted to detect exact duplicates in documents. Then, our algorithm uses these exact duplicates to construct near ones. We evaluate the proposed algorithm using the documentation of 19 open source and commercial projects. Our evaluation is very comprehensive - it covers various documentation types: design and requirement specifications, programming guides and API documentation, user manuals. Overall, the evaluation shows that all kinds of software documentation contain a significant number of both exact and near duplicates. Next, we report on the performed manual analysis of the detected near duplicates for the Linux Kernel Documentation. We present both quantative and qualitative results of this analysis, demonstrate algorithm strengths and weaknesses, and discuss the benefits of duplicate management in software documents.
본문 54,022자
본문 펼치기
# Detecting Near Duplicates in Software Documentation
#### D.V. Luciv 1, D.V. Koznov 1, G.A. Chernishev 1, A.N. Terekhov 1 1 Saint Petersburg State University _199034 St. Petersburg, Universitetskaya Emb., 7–9_ _E-mail: {d.lutsiv, d.koznov, g.chernyshev, a.terekhov}@spbu.ru_ 2017-11-15
Abstract
Contemporary software documentation is as complicated as the software itself. During its
lifecycle, the documentation accumulates a lot of “near duplicate” fragments, i.e. chunks of
text that were copied from a single source and were later modified in different ways. Such
near duplicates decrease documentation quality and thus hamper its further utilization. At
the same time, they are hard to detect manually due to their fuzzy nature. In this paper
we give a formal definition of near duplicates and present an algorithm for their detection in software documents. This algorithm is based on the exact software clone detection
approach: the software clone detection tool Clone Miner was adapted to detect exact duplicates in documents. Then, our algorithm uses these exact duplicates to construct near ones.
We evaluate the proposed algorithm using the documentation of 19 open source and commercial projects. Our evaluation is very comprehensive - it covers various documentation
types: design and requirement specifications, programming guides and API documentation, user manuals. Overall, the evaluation shows that all kinds of software documentation
contain a significant number of both exact and near duplicates. Next, we report on the
performed manual analysis of the detected near duplicates for the Linux Kernel Documentation. We present both quantative and qualitative results of this analysis, demonstrate
algorithm strengths and weaknesses, and discuss the benefits of duplicate management in
software documents.
_Keywords:_ _software_ _documentation,_ _near_ _duplicates,_ _documentation_ _reuse,_ _software_ _clone_
_detection._
### 1 Introduction
Every year software is becoming increasingly
more complex and extensive, and so does software documentation. During the software life
cycle documentation tends to accumulate a lot
of duplicates due to the copy and paste pattern. At first, some text fragment is copied
several times, then each copy is modified, possibly in its own way. Thus, different copies of
This work is partially supported by RFBR grant
No 16-01-00304.
initially similar fragments become “near duplicates”. Depending on the document type [1],
duplicates can be either desired or not, but
in any case duplicates increase documentation
complexity and thus, maintenance and authoring costs [2].
Textual duplicates in software documentation, both exact and near ones, are extensively
studied [2, 3, 4, 5]. However, there are no methods for detection of near duplicates, only for
exact ones and mainly using software clone detection techniques [2, 3, 6]. At the same time
Juergens et al. [2] indicates the importance of
near duplicates and recommends to “pay par
<u>2</u> <u>D.V.</u> <u>Luciv,</u> <u>D.V.</u> <u>Koznov,</u> <u>G.A.</u> <u>Chernishev,</u> <u>A.N.</u> <u>Terekhov</u>
ticular attention to subtle differences in duplicated text”. However, there are studies which
addressed near duplicates, for example in [7]
the authors developed a duplicate specification
tool for JavaDoc documentation. This tool allows user to specify near duplicates and manipulate them. Their approach was based on
an informal definition of near duplicates and
the problem of duplicate detection was not addressed. In our previous studies [8, 9] we presented a near duplicate detection approach. Its
core idea is to uncover near duplicates and then
to apply the reuse techniques described in our
earlier studies [4, 5]. Clone detection tool Clone
Miner [10] was adapted for detection of exact
duplicates in documents, then near duplicates
were extracted as combinations of exact duplicates. However, only near duplicates with
one variation point were considered. In other
words, the approach can detect only near duplicates that consist of two exact duplicates with
a single chunk of variable text between them:
_?????_ 1 _????????_ 1 _?????_ 2.
In this paper we give the formal definition of near duplicates with an arbitrary number of variation points,
exhibiting the following pattern:
_?????_ 1 _????????_ 1 _?????_ 2 _????????_ 2 _?????_ 3 _. . ._
_?????????−_ 1 _??????_ . Our definition is the
formalized version of the definition given
in the reference [11]. We also present a
generalization of the algorithm described in
[8, 9]. The algorithm is implemented in the
Documentation Refactoring Toolkit [12], which
is a part of the DocLine project [4]. In this
paper, an evaluation of the proposed algorithm
is also presented. The documentation of 19
open source and commercial projects is used.
The results of the detailed manual analysis
of the detected near duplicates for the Linux
Kernel Documentation [13] are reported.
The paper is structured as follows. Section 1 provides a survey of duplicate management for software documentation and gives a
brief overview of near duplicate detection methods in information retrieval, theoretical computer science, and software clone detection areas. Section 2 describes the context of this
study by examining our previous work to un
derline the contribution of the current paper.
In Section 3 the formal definition of the near
duplicate is given and the near duplicate detection algorithm is presented. Also, the algorithm correctness theorem is formulated. Finally, Section 4 presents evaluation results.
### 2 Related work
Let us consider how near duplicates are employed in documentation-oriented software engineering research. Horie et al. [14] consider
the problem of text fragment duplicates in Java
API documentation. The authors introduce a
notion of crosscutting concern, which is essentially a textual duplicate appearing in documentation. The authors present a tool named
CommentWeaver, which provides several mechanisms for modularization of the API documentation. It is implemented as an extention of
Javadoc tool, and provides new tags for controlling reusable text fragments. However, near
duplicates are not considered, facilities for duplicate detection are not provided.
Nos´al and Porub¨an [7] extend the approach from [14] by introducing near duplicates. In this study the notion of documentation phrase is used to denote the near duplicate. Parametrization is used to define variative parts of duplicates, similarly to our approach [4, 5]. However, the authors left the
problem of near duplicate detection untouched.
In [3] Nos´al and Porub¨an present the results
of a case study in which they searched for exact
duplicates in internal documentation (source
code comments) of an open source project set.
They used a modified copy/paste detection
tool, which was originally developed for code
analysis and found considerable number of text
duplicates. However, near duplicates were not
considered in this paper.
Wingkvist et al. adapted a clone detection
tool to measure the document uniqueness in
a collection [6]. The authors used found duplicates for documentation quality estimation.
However, they did not address near duplicate
detection.
The work of Juergens et al. [2] is the closest
one to our research and presents a case study
<u>Detecting</u> <u>Near</u> <u>Duplicates</u> <u>in</u> <u>Software</u> <u>Documentation</u> <u>3</u>
for analyzing redundancy in requirement specifications. The authors analyze 28 industrial
documents. At the first step, they found duplicates using a clone detection tool. Then, the
authors filtered the found duplicates by manually removing false positives and performed a
classification of the results. They report that
the average duplicate coverage of documents
they analyzed is 13.6%: some documents have
a low coverage (0.9%, 0.7% and even 0%), but
there are ones that have a high coverage (35%,
51.1%, 71.6%). Next, the authors discuss how
to use discovered duplicates and how to detect related duplicates in the source code. The
impact of duplicates on the document reading
process is also studied. Furthermore, the authors propose a classification of meaningful duplicates and false positive duplicates. However,
it should be noted that they consider only requirement specifications and ignore other kinds
of software documentation. Also, they do not
use near duplicates.
Rago et al. [15] apply natural language processing and machine learning techniques to the
problem of searching duplicate functionality in
requirement specifications. These documents
are considered as a set of textual use cases; the
approach extracts sequence chain (usage scenarios) for every use case and compares the
pairs of chains to find duplicate subchains. The
authors evaluate their approach using several
industrial requirement specifications. It should
be noted that this study considers a very special type of requirement specifications, which
are not widely used in industry. Near duplicates are also not considered.
Algorithms for duplicate detection in textual
content have been developed in several other areas. Firstly, the information retrieval community considered several near-duplicate detection
problems: document similarity search [16, 17],
(local) text reuse detection [18, 19], template
detection in web document collections [20, 21].
Secondly, the plagiarism detection community
also extensively studied the detection of similarity between documents [22, 23]. Thus, there
are a number of efficient solutions. However,
the majority of them are focused on documentlevel similarity, with the goal of attaining high
performance on the large collections of documents. More importantly, these studies differ from ours by ignoring duplicate meaningfulness. Nonetheless, adapting these methods
for the near-duplicate search in software documentation could improve the quality metrics of
the search. It is a promising avenue for further
studies.
The theoretical computer science community
also addressed the duplicate detection problem.
However, the primary focus of this community
was the development of (an approximate) string
matching algorithms. For example, in order to
match two text fragments of an equal length,
the Hamming distance was used [24]. The Levenshtein distance [25] is employed to account
not only for symbol modification, but also for
symbol insertion and removal. For this metric
it is possible to handle all the three editing operations at the cost of performance [26]. Significant performance optimizations to string pattern matching using the Levenshtein distance
were applied in the fuzzy Bitap algorithm [27]
which was later optimized to handle longer patterns efficiently [28]. Similarity preserving signatures like MinHash [29] can be used to speed
up pattern matching for approximate matching
problem. Another indexing approach is proposed in [30], with an algorithm for the fast
detection of documents that share a common
sliding window with the query pattern but differ by at most _?_ tokens. While being useful for
our goals in general, these studies do not relate to this paper directly. All of these studies
are focused on the performance improvement of
simple string matching tasks. Achieving high
performance is undoubtedly an important aspect, but these algorithms become less necessary when employed for documents of 3–4 MBs
of plain text — a common size of a large industrial documentation file.
Various techniques have been employed to
detect near duplicate clones in a source code.
SourcererCC [31] detects near duplicates of
code blocks using a static bag-of-tokens strategy that is resilient to minor differences between code blocks. Clone candidates of a code
block are queried from a partial inverted index
for better scalability. DECKARD [32] com
<u>4</u> <u>D.V.</u> <u>Luciv,</u> <u>D.V.</u> <u>Koznov,</u> <u>G.A.</u> <u>Chernishev,</u> <u>A.N.</u> <u>Terekhov</u>
putes certain characteristic vectors of code to
approximate the structure of Abstract Syntax
Trees in Euclidean space. Locality sensitive
hashing (LSH) [33] is used to group similar vectors with the Euclidean distance metric, forming clones. NICAD [34] is a text-based near duplicate detection tool that also uses tree-based
structural analysis with a lightweight parsing of
the source code to implement flexible prettyprinting, code normalization, source transformation and code filtering for better results.
However, these techniques are not directly capable of detecting duplicates in text documents
as they involve some degree of parsing of the
underlying source code for duplicate detection.
Suitable customization for this purpose can be
explored in the future.
### 3 Background
#### 3.1 Exact duplicate detection and Clone Miner
Not only documentation, but also software itself is often developed with a lot of copy/pasted
information. To cope with duplicates in the
source code, software clone detection methods
are used. This area is quite mature; a systematic review of clone detection methods and
tools can be found in [35]. In this paper, the
Clone Miner [10] software clone detection tool
is used to detect exact duplicates in software
documentation. Clone Miner is a token-based
source code clone detector. A token in the context of text documents is a single word separated from other words by some separator: ‘.’,
‘(’, ‘)’, etc. For example, the following text
fragment consists of 2 tokens: “FM registers”.
Clone Miner considers input text as an ordered
collection of lexical tokens and applies suffix
array-based string matching algorithms [36] to
retrieve the repeated parts (clones). In this
study we use the Clone Miner tool. We have
selected it for its simplicity and its ability to
be easily integrated with other tools using a
command line interface.
#### 3.2 Basic near duplicate detec- tion and refactoring
We have already demonstrated in Section 1
that near duplicate detection in software documentation is an important research avenue.
In our previous studies [8, 9], we presented
an approach that offers a partial solution for
this problem. At first, similarly to Juergens
et al. [2], Wingkvist et al. [6], we applied software clone detection techniques to exact duplicate detection [37]. Then, in [8, 9] we proposed an approach to near duplicate detection.
It is essentially as follows: having exact duplicates found by Clone Miner, we extract sets
of duplicate groups where clones are located
close to each other. For example, suppose that
the following phrase can be found in the text
5 times with different variations (various port
numbers): “inet daemon can listen on ... port
and then transfer the connection to appropriate handler”. In this case we have two duplicate
groups with 5 clones in each group: one group
includes the text “inet daemon can listen on”,
while the other includes “port and then transfer the connection to appropriate handler”. We
combine these duplicate groups into a group
of near duplicates: every member of this group
has one variation to capture different port numbers. In these studies we developed this approach only for one variation, i.e. we “glued”
only pairs of exact duplicate groups.
Then it is possible to apply the adaptive
reuse technique [38, 39] to near duplicates
and to perform automatic refactoring of documentation. Our toolkit [12] allows to create
reusable text fragment definition templates for
the selected near duplicate group. Then it is
possible to substitute all the occurrences of the
group’s members with parameterized references
to definition. The overall scheme of the process
is shown in Fig. 1.
The experiments with the described approach showed a considerable number of interesting near duplicates. Thus, we decided to
generalize the algorithm from [8, 9] in order
to allow an arbitrary number of exact nearduplicates combinations. This will allow to
have several variation parts in the resulting
<u>Detecting</u> <u>Near</u> <u>Duplicates</u> <u>in</u> <u>Software</u> <u>Documentation</u> <u>5</u>
Input
document
Preparation for
clone detection
Document clone
detection
Clone detection
(Clone Miner)
Modified
Refactoring Filtering
document
Figure 1: The process of near duplicate search
near duplicates. The generalized algorithm is
described below.
### 4 Near duplicate detection algorithm
#### 4.1 Definitions
Let us define the terms necessary for describing the proposed algorithm. We consider document _?_ as a sequence of symbols. Any symbol of _?_ has a coordinate corresponding to
its offset from the beginning of the document,
and this coordinate is a number belonging to
[1 _, ?????ℎ_ ( _?_ )] interval, where _?????ℎ_ ( _?_ ) is the
number of symbols in _?_ .
Definition 1. _For_ _?_ _we_ _define_ _a_ _text_ _frag-_
_ment_ _as_ _an_ _occurrence_ _of_ _some_ _text_ _substring_
_in_ _?._ _Hence,_ _each_ _text_ _fragment_ _has_ _a_ _corre-_
_sponding_ _integer_ _interval_ [ _?, ?_ ] _,_ _where_ _?_ _is_ _the_
_coordinate_ _of_ _its_ _first_ _symbol_ _and_ _?_ _is_ _the_ _coor-_
_dinate_ _of_ _its_ _last_ _symbol._ _For_ _text_ _fragment ?_ _of_
_document_ _?,_ _we_ _say_ _that_ _?_ _∈_ _?._
Let us introduce the following sets: _?_ <sup>_*_</sup> is a
set of all text fragments of _?_, _?_ <sup>_?_</sup> is a set of all
integer intervals within interval [1 _, ?????ℎ_ ( _?_ )],
_?_ <sup>_?_</sup> is a set of all strings of _?_ .
Also, let us introduce the following notations:
- [ _?_ ] : _?_ <sup>_*_</sup> _→_ _?_ <sup>_?_</sup> is a function that takes text
fragment _?_ and returns its interval.
- _???_ ( _?_ ) : _?_ <sup>_*_</sup> _→_ _?_ <sup>_?_</sup> is a function that takes
text fragment _?_ and returns its text.
- _?_ : _?_ <sup>_?_</sup> _→_ _?_ <sup>_*_</sup> is a function that takes interval _?_ and returns corresponding text fragment.
- _|_ [ _?, ?_ ] _|_ : _?_ <sup>_?_</sup> _→_ [0 _, ?????ℎ_ ( _?_ )] is a function
that takes interval [ _?_ ] = [ _?, ?_ ] and returns
its length as _|_ [ _?_ ] _|_ = _?−?_ +1. For simplicity,
we will use _|?|_ notion instead of _|_ [ _?_ ] _|_ .
- For any _?_ <sup>1</sup> _, ?_ <sup>2</sup> _∈_ _?_ we consider their intersection _?_ <sup>1</sup> _∩_ _?_ <sup>2</sup> as intersection of corresponding intervals [ _?_ <sup>1</sup> ] _∩_ [ _?_ <sup>2</sup> ], and _?_ <sup>1</sup> _⊂_ _?_ <sup>2</sup>
implies [ _?_ <sup>1</sup> ] _⊂_ [ _?_ <sup>2</sup> ].
- We define the binary predicate _??????_
on _?_ <sup>_*_</sup> _× ?_ <sup>_*_</sup>, which is true for text fragments _?_ <sup>1</sup> _, ?_ <sup>2</sup> _∈_ _?_, iff _?_ <sup>1</sup> _<_ _?_ <sup>2</sup>, when [ _?_ <sup>1</sup> ] =
[ _?_ <sup>1</sup> _, ?_ <sup>1</sup> ] _,_ [ _?_ <sup>2</sup> ] = [ _?_ <sup>2</sup> _, ?_ <sup>2</sup> ].
Definition 2. _Let_ _us_ _consider_ _a_ _set_ _?_ _of_ _text_
_fragments of ?_ _such that ∀?_ <sup>1</sup> _, ?_ <sup>2</sup> _∈_ _?_ ( _???_ ( _?_ <sup>1</sup> ) =
_???_ ( _?_ <sup>2</sup> )) _∧_ ( _?_ <sup>1</sup> _∩_ _?_ <sup>2</sup> = _∅_ ) _._ _We_ _name_ _those_ _frag-_
_ments_ _as_ _exact_ _duplicates_ _and_ _?_ _as_ _exact_
_duplicate_ _group_ _or_ _exact_ _group_ _._ _We_ _also_
_denote_ _number_ _of_ _elements_ _in_ _?_ _as_ # _?._
Definition 3. _For_ _ordered_ _set_ _of_ _exact_ _dupli-_
_cate_ _groups_ _?_ 1 _, . . ., ??_ _,_ _we_ _say_ _that_ _it_ _forms_
_variational_ _group_ _⟨?_ 1 _, . . ., ??_ _⟩_ _when the fol-_
_lowing_ _conditions_ _are_ _satisfied:_
_1._ # _?_ 1 = _. . ._ = # _??_ _._
_?_ 1 <sup>3</sup> <sup>_. . . ?_</sup> 2 <sup>3</sup> <sup>_. . . ?_</sup> 3 <sup>3.</sup> <sup>Next,</sup> <sup>it</sup> <sup>should</sup> <sup>be</sup> <sup>possible</sup> <sup>to</sup>
compute the distance between variations or exact duplicate groups. This is required to support group merging inside our algorithm which
_2._ _Text_ _fragments_ _having_ _similar_ _positions_ _in_
_different groups, occur in the same order in_
_document_ _text:_ _∀??_ <sup>_?_</sup> <sup>_∈_</sup> <sup>_??_</sup> <sup>_∀?_</sup> _?_ <sup>_?_</sup> <sup>_∈_</sup> <sup>_??_</sup> <sup>((</sup> <sup>_?<_</sup>
_?_ <sup>_?_</sup> <sup>_∈_</sup> <sup>_??_</sup> <sup>_∀?_</sup> _?_ <sup>_?_</sup>
_document_ _text:_ _∀??_ <sup>_?_</sup> <sup>_∈_</sup> <sup>_??_</sup> <sup>_∀?_</sup> _?_ <sup>_?_</sup> <sup>_∈_</sup> <sup>_??_</sup> <sup>((</sup> <sup>_?<_</sup>
_?_ ) _⇔_ _??????_ ( _??_ <sup>_?, ?_</sup> _?_ <sup>_?_</sup> <sup>))</sup> <sup>_,_</sup> <sup>_and_</sup>
_?_ <sup>_?, ?_</sup> _?_ <sup>_?_</sup>
_?_ ) _⇔_ _??????_ ( _??_ <sup>_?, ?_</sup> _?_ <sup>_?_</sup> <sup>))</sup> <sup>_,_</sup> <sup>_and_</sup>
_∀_ _?_ _∈{_ 1 _,_ _. . .,_ _?_ _−_ 1 _}??????_ ( _??_ <sup>_?_</sup>
1 <sup>_?_</sup> <sup>+1</sup> ) _._
_?_ <sup>_?_</sup> <sup>_, ?_</sup> 1 <sup>_?_</sup> <sup>+1</sup>
_We_ _also_ _say_ _that_ _for_ _any_ _??_ _of_ _this_ _set_ _??_ _∈_
_??._
Note 1. _According_ _to_ _condition_ _2_ _of_ _defini-_
_tion_ _3,_ _∀??_ <sup>_?_</sup> <sup>_∈_</sup> <sup>_??, ∀?_</sup> _?_ <sup>_?_</sup> <sup>_∈_</sup> <sup>_??_</sup> <sup>(</sup> <sup>_?̸_</sup> <sup>=</sup> <sup>_?_</sup> <sup>_⇒_</sup> <sup>_?_</sup> _?_ <sup>_?_</sup> <sup>_∩_</sup> <sup>_?_</sup> _?_ <sup>_?_</sup> <sup>=</sup>
_?_ <sup>_?_</sup> <sup>_∈_</sup> <sup>_??, ∀?_</sup> _?_ <sup>_?_</sup> <sup>_̸_</sup>
<sup>_̸_</sup> _?_ <sup>_?_</sup> <sup>_∩_</sup> <sup>_?_</sup> _?_ <sup>_?_</sup>
_?_ <sup>_?_</sup> <sup>_∈_</sup> <sup>_??_</sup> <sup>(</sup> <sup>_?̸_</sup> <sup>=</sup> <sup>_?_</sup> <sup>_⇒_</sup> <sup>_?_</sup> _?_ <sup>_?_</sup>
_tion_ _3,_ _∀??_ <sup>_?_</sup> <sup>_∈_</sup> <sup>_??, ∀?_</sup> _?_ <sup>_?_</sup> <sup>_∈_</sup> <sup>_??_</sup> <sup>(</sup> <sup>_?̸_</sup> <sup>=</sup> <sup>_?_</sup> <sup>_⇒_</sup> <sup>_?_</sup> _?_ <sup>_?_</sup> <sup>_∩_</sup> <sup>_?_</sup> _?_ <sup>_?_</sup> <sup>=</sup>
_∅_ ) _._
Note 2. _When_ _??_ = _⟨?_ 1 _, . . ., ??_ _⟩_ _and_
_??_ <sup>_′_</sup> = _⟨?_ <sup>_′_</sup> 1 <sup>_, . . ., ?′_</sup> _?_ <sup>_⟩,_</sup> <sup>_are_</sup> <sup>_variational_</sup> <sup>_groups,_</sup>
_??_ <sup>_′_</sup> = _⟨?_ <sup>_′_</sup> 1 <sup>_, . . ., ?′_</sup> _?_ <sup>_⟩,_</sup> <sup>_are_</sup> <sup>_variational_</sup> <sup>_groups,_</sup>
_⟨??, ??_ <sup>_′_</sup> _⟩_ = _⟨?_ 1 _, . . ., ??_ _, ?_ <sup>_′_</sup> 1 <sup>_, . . ., ?′_</sup> _?_ <sup>_⟩_</sup> <sup>_is_</sup> <sup>_also_</sup>
_⟨??, ??_ <sup>_′_</sup> _⟩_ = _⟨?_ 1 _, . . ., ??_ _, ?_ <sup>_′_</sup> 1 <sup>_, . . ., ?′_</sup> _?_ <sup>_⟩_</sup> <sup>_is_</sup> <sup>_also_</sup>
_a variational group in case when is satisfies def-_
_inition_ _3._
For example, suppose that we have _??_ =
_⟨?_ 1 _, ?_ 2 _, ?_ 3 _⟩_ and each of _??_ consists of three
clones _??_ <sup>_?,_</sup> _?_ _∈_ _{_ 1 _,_ 2 _,_ 3 _}_ . Then, these
clones _??_ <sup>_?,_</sup> _?_ _∈_ _{_ 1 _,_ 2 _,_ 3 _}_ . Then, these
clones appear in the text in the following
order: _?_ 1 <sup>1</sup> <sup>_. . . ?_</sup> 2 <sup>1</sup> <sup>_. . . ?_</sup> 3 <sup>1</sup> <sup>_. . . . . . ?_</sup> 1 <sup>2</sup> <sup>_. . . ?_</sup> 2 <sup>2</sup> <sup>_. . . ?_</sup> 3 <sup>2</sup> <sup>_. . . . . ._</sup>
order: _?_ 1 <sup>1</sup> <sup>_. . . ?_</sup> 2 <sup>1</sup> <sup>_. . . ?_</sup> 3 <sup>1</sup> <sup>_. . . . . . ?_</sup> 1 <sup>2</sup> <sup>_. . . ?_</sup> 2 <sup>2</sup> <sup>_. . . ?_</sup> 3 <sup>2</sup> <sup>_. . . . . ._</sup>
_?_ 1 <sup>3</sup> <sup>_. . . ?_</sup> 2 <sup>3</sup> <sup>_. . . ?_</sup> 3 <sup>3.</sup> <sup>Next,</sup> <sup>it</sup> <sup>should</sup> <sup>be</sup> <sup>possible</sup> <sup>to</sup>
<u>6</u> <u>D.V.</u> <u>Luciv,</u> <u>D.V.</u> <u>Koznov,</u> <u>G.A.</u> <u>Chernishev,</u> <u>A.N.</u> <u>Terekhov</u>
selects several closest groups to form a new one.
Thus, a distance function should be defined.
Definition 4. _Distance_ _between_ _text_ _frag-_
_ments_ _for_ _any_ _?_ <sup>1</sup> _, ?_ <sup>2</sup> _∈_ _?_ _is_ _defined_ _as_ _follows:_
_????_ ( _?_ <sup>1</sup> _, ?_ <sup>2</sup> ) =
⎧
⎪
⎨
0 _,_ _?_ <sup>1</sup> _∩_ _?_ <sup>2</sup> <sup>_̸_</sup> = _∅,_
_?_ <sup>2</sup> _−_ _?_ <sup>1</sup> + 1 _,_ _??????_ ( _?_ <sup>1</sup> _, ?_ <sup>2</sup> ) _,_
_?_ <sup>1</sup> _−_ _?_ <sup>2</sup> + 1 _,_ _??????_ ( _?_ <sup>2</sup> _, ?_ <sup>1</sup> ) _,_
⎪
⎩
(1)
_where_ [ _?_ <sup>1</sup> ] = [ _?_ <sup>1</sup> _, ?_ <sup>1</sup> ] _and_ [ _?_ <sup>2</sup> ] = [ _?_ <sup>2</sup> _, ?_ <sup>2</sup> ] _._
Definition 5. _Distance_ _between_ _exact_
_groups_ _?_ 1 _and_ _?_ 2 _,_ _having_ # _?_ 1 = # _?_ 2 _,_ _is_
_defined_ _as_ _follows:_
_????_ ( _?_ 1 _, ?_ 2) = _?∈{_ 1max _,...,_ # _?_ 1 _}_ <sup>_????_</sup> <sup>(</sup> <sup>_?_</sup> 1 <sup>_?, ?_</sup> 2 <sup>_?_</sup> <sup>)</sup> (2)
Definition 6. _Distance_ _between_ _varia-_
_tional_ _groups_ _??_ 1 _and_ _??_ 2 _,_ _when_ _there_ _are_
_?_ 1 _∈_ _??_ 1 _, ?_ 2 _∈_ _??_ 2 : # _?_ 1 = # _?_ 2 _,_ _is_ _defined_
_as_ _follows:_
_????_ ( _??_ 1 _, ??_ 2) = _?_ 1 _∈??_ max1 _,?_ 2 _∈??_ 2 <sup>_????_</sup> <sup>(</sup> <sup>_?_</sup> <sup>1</sup> <sup>_,?_</sup> <sup>2)</sup>
(3)
Definition 7. _Length_ _of_ _exact_ _group_ _?_ _is_
Note 3. _An_ _exact_ _group_ _?_ _can_ _be_ _considered_
_as_ _a_ _variational_ _one_ _formed_ _by_ _itself:_ _⟨?⟩._
Definition 10. _Consider_ _near_ _duplicate_ _group_
_⟨?_ 1 _, ?_ 2 _⟩,_ _where_ _?_ 1 _and_ _?_ 2 _are_ _exact_ _groups._
_We_ _assume_ _that_ _this_ _group_ _contains_ _a_ _single_
_extension_ _point_ _,_ _and_ _the_ _text_ _fragments_ _con-_
_tained_ _in_ _positions_ [ _?_ <sup>_?_</sup> 1 <sup>+1</sup> <sup>_, ??_</sup> 2 <sup>_−_</sup> <sup>1]</sup> <sup>_are_</sup> <sup>_called_</sup> <sup>_ex-_</sup>
_tension_ _point_ _values_ _._ _In_ _the_ _general_ _case,_ _a_
_near_ _duplicate_ _group_ _⟨?_ 1 _, . . ., ??_ _⟩_ _has_ _?_ _−_ 1
extension points _._
Definition 11. _Consider_ _two_ _near_ _dupli-_
_cate_ _groups_ _?_ = _⟨?_ 1 _, . . ., ??⟩_ _and_ _?_ <sup>_′_</sup> =
_⟨?_ <sup>_′_</sup> 1 <sup>_, . . . ?′_</sup> _?_ <sup>_⟩._</sup> _Suppose_ _that_ _they_ _form_ _a_
_⟨?_ <sup>_′_</sup> 1 <sup>_, . . . ?′_</sup> _?_ <sup>_⟩._</sup> _Suppose_ _that_ _they_ _form_ _a_
_variational_ _group_ _⟨?_ 1 _, . . ., ??, ?_ <sup>_′_</sup> 1 <sup>_, . . ., ?′_</sup> _?_ <sup>_⟩_</sup> <sup>_or_</sup>
_variational_ _group_ _⟨?_ 1 _, . . ., ??, ?_ <sup>_′_</sup> 1 <sup>_, . . ., ?′_</sup> _?_ <sup>_⟩_</sup> <sup>_or_</sup>
_⟨?_ 1 _, . . ., ??, ?_ <sup>_′_</sup> 1 <sup>_, . . ., ?′_</sup> _?_ <sup>_⟩,_</sup> <sup>_which_</sup> <sup>_in_</sup> <sup>_turn_</sup> <sup>_is_</sup> <sup>_also_</sup>
_⟨?_ 1 _, . . ., ??, ?_ <sup>_′_</sup> 1 <sup>_, . . ., ?′_</sup> _?_ <sup>_⟩,_</sup> <sup>_which_</sup> <sup>_in_</sup> <sup>_turn_</sup> <sup>_is_</sup> <sup>_also_</sup>
_a_ _near_ _duplicate_ _group._ _In_ _this_ _case,_ _we_ _call_ _?_
_and_ _?_ <sup>_′_</sup> _nearby_ _groups_ _._
_defined as follows:_ _?????ℎ_ ( _?_ ) =
_where_ _?_ <sup>_?_</sup> _∈_ _?,_ [ _?_ <sup>_?_</sup> ] = [ _?_ <sup>_?_</sup> _, ?_ <sup>_?_</sup> ] _._
# _?_
∑︀
_?_ =1
( _?_ <sup>_?_</sup> _−?_ <sup>_?_</sup> +1) _,_
Definition 8. _Length_ _of_ _variational_ _group_
_??_ = _⟨?_ 1 _, . . ., ??_ _⟩_ _is_ _defined_ _as_ _follows:_
_?????ℎ_ ( _??_ ) =
_?_
∑︁
_?_ =1
_?????ℎ_ ( _??_ ) (4)
Definition 9. _Near_ _duplicate_ _group_ _is_ _such_
_a_ _variational_ _group_ _⟨?_ 1 _, . . ., ??_ _⟩_ _that_ _satisfies_
_following_ _condition_ _for_ _∀?_ _∈{_ 1 _, . . .,_ # _?_ 1 _}:_
_?_ _−_ 1
∑︁
_?_ =1
_????_ ( _??_ <sup>_?_</sup>
_?_ <sup>_?,?_</sup> _?_ <sup>_?_</sup>
_?_ <sup>_?_</sup> +1 <sup>)</sup> <sup>_≤_</sup> <sup>0</sup> <sup>_._</sup> <sup>15</sup> <sup>_*_</sup>
Definition 12. _Nearby_ _duplicates_ _are_ _dupli-_
_cates_ _belonging_ _to_ _nearby_ _groups._
Note 4. _Due_ _to_ _remark_ _3,_ _definition_ _12_ _is_ _ap-_
_plicable_ _to_ _both_ _near_ _and_ _exact_ _duplicates._
#### 4.2 Algorithm description
The algorithm that constructs the set of near
duplicate groups ( _?????_ ) is presented below.
Its input is the set of exact duplicate groups
( _????_ ) belonging to document _?_ . It employs
an interval tree - a data structure whose purpose is to quickly locate intervals that intersect with a given interval. Initially, the _????_
set is created using the Clone Miner tool. The
core idea of our algorithm is to repeatedly find
and merge nearby exact groups from _????_ . At
each step, the resulting near duplicate groups
are added to _?????_ . Let us consider this algorithm in detail.
The initial interval tree for _????_ is constructed using the _????????_ () function (line
2). The core part of the algorithm is a loop
in which new near duplicate groups are constructed (lines 3–18). This loop repeats until
we can construct at least one near duplicate
group, i.e. the set of newly constructed near
duplicate groups ( _??????_ ) is not empty (line
18). Inside of this loop, the algorithm cycles
through all groups of _????_ _∪_ _?????_ . For each
_?_
∑︁
_?_ =1
_|??_ <sup>_?|._</sup> (5)
This definition is constructed according to
the near duplicate concept from [38]: variational part of near duplicates with similar information ( _delta_ ) should not exceed 15% of their
exact duplicate ( _archetype_ ) part.
<u>Detecting</u> <u>Near</u> <u>Duplicates</u> <u>in</u> <u>Software</u> <u>Documentation</u> <u>7</u>
Algorithm 1: Near Duplicate Groups Con<u>struction</u>
Input data: _????_
Result: _?????_
1 _?????_ _←∅_
2 _????????_ ()
3 repeat
4 _??????_ _←∅_
5 foreach _?_ _∈_ _????_ _∪_ _?????_ do
6 _???????_ _←_ _??????_ ( _?_ )
7 if _???????̸_ = _∅_ then
8 _?_ <sup>_′_</sup> _←_ _??????????_ ( _?, ???????_ )
9 _??????_ ( _?,?_ <sup>_′_</sup> )
10 if _??????_ ( _?,?_ <sup>_′_</sup> ) then
11 _??????_ _←_ _??????_ _∪{⟨?, ?_ <sup>_′_</sup> _⟩}_
12 else
13 _??????_ _←_ _??????_ _∪{⟨?_ <sup>_′_</sup> _, ?⟩}_
14 end if
15 end if
16 end foreach
17 _????_ ( _?????, ??????_ )
18 until _??????_ = _∅_
19 _?????_ _←_ _?????_ _∪_ _????_
of them, the _??????_ function returns the set
of nearby groups _???????_ (lines 5, 6), which
is then used for constructing near duplicate
groups. Later, we will discuss this function in
more detail and prove its correctness, i.e. that
it actually returns groups that are close to _?_ .
Next, the closest group to _?_, denoted _?_ <sup>_′_</sup>, is selected from _???????_ (line 8) and a variational
group _⟨?, ?_ <sup>_′_</sup> _⟩_ or _⟨?_ <sup>_′_</sup> _, ?⟩_ is created. This group
is added into _??????_ (lines 10–14). Since _?_
and _?_ <sup>_′_</sup> are merged and therefore cease to exist
as independent entities, they are deleted from
_????_ and _?????_ by the _??????_ function (line
9). Next, the _????_ function adds _??????_ to
_?????_ (line 17). It is essential to note that
the _??????_ and _????_ functions perform some
auxiliary actions described below.
In the end of the algorithm _????_ is added
to _?????_ . The result - _?????_ - is presented as the algorithm’s output. This step is
required in order for the output to contain not
only near duplicate groups, but also exact duplicate groups which have not been used for
creation of near duplicate ones (line 19).
Let us describe the functions employed in
this algorithm.
The _????????_ () function builds the interval
tree. The idea of this data structure is the following.
Suppose we have _?_ natural number intervals,
where _?_ 1 is the minimum and _??_ is the maximum value of all interval endpoints, and _?_ is
the midpoint of [ _?_ 1 _, ??_ ]. The intervals are divided into three groups: fully located to the
left of _?_, fully located to the right of _?_, and
intervals containing _?_ . The current node of the
interval tree stores the last interval group and
references to its left and right child nodes containing the intervals to the left and to the right
of _?_ respectively. This procedure is repeated
for each child node. Further details regarding
the construction of an interval tree can be found
in [40, 41].
In this study, we build our interval tree from
the extended intervals that correspond to the
exact duplicates found by CloneMiner. These
extended intervals are obtained as follows: original intervals belonging to exact duplicates are
enlarged by 15%. For example, if [ _?, ?_ ] is
the initial interval, then an extended one is
[ _?_ _−_ 0 _._ 15 _*_ ( _?_ _−_ _?_ + 1) _, ?_ + 0 _._ 15 _*_ ( _?_ _−_ _?_ + 1)].
We will denote the extended interval that corresponds to the exact duplicate _?_ as _↕_ _?_ . We
also modify our interval tree as follows: each
stored interval keeps the reference to the corresponding exact duplicate group.
The _??????_ function removes groups from
sets and their intervals from the interval tree.
The interval deletion algorithm is described in
references [40, 41].
The _????_ function, in addition to the operations described above, adds intervals of
the newly created near duplicate group _?_ =
_⟨?_ 1 _, . . ., ??_ _⟩_ to the interval tree. The standard insertion algorithm described in references [40, 41] is used. Extended intervals
added to the tree of each near duplicate _?_ <sup>_?_</sup> =
( _?_ 1 <sup>_?,..., ?_</sup> _?_ <sup>_?_</sup> <sup>),</sup> <sup>where</sup> <sup>_?_</sup> <sup>_∈{_</sup> <sup>1</sup> <sup>_, . . .,_</sup> <sup>#</sup> <sup>_?_</sup> <sup>1</sup> <sup>_}_</sup> <sup>,</sup> <sup>have</sup> <sup>the</sup>
extended interval of _?_ <sup>_?_</sup> (now, a near duplicate)
as _↕_ _?_ <sup>_?_</sup> as well.
( _?_ 1 <sup>_?,..., ?_</sup> _?_ <sup>_?_</sup> <sup>),</sup> <sup>where</sup> <sup>_?_</sup> <sup>_∈{_</sup> <sup>1</sup> <sup>_, . . .,_</sup> <sup>#</sup> <sup>_?_</sup> <sup>1</sup> <sup>_}_</sup> <sup>,</sup> <sup>have</sup> <sup>the</sup>
form of [ _?_ <sup>_?_</sup> 1 <sup>_−_</sup> <sup>_??, ?_</sup> _?_ <sup>_?_</sup> <sup>+</sup> <sup>_??_</sup> <sup>],</sup> <sup>where</sup> <sup>_??_</sup> <sup>=</sup> <sup>0</sup> <sup>_._</sup> <sup>15</sup> <sup>_*_</sup>
form of [ _?_ <sup>_?_</sup> 1 <sup>_−_</sup> <sup>_??, ?_</sup> _?_ <sup>_?_</sup> <sup>+</sup> <sup>_??_</sup> <sup>],</sup> <sup>where</sup> <sup>_??_</sup> <sup>=</sup> <sup>0</sup> <sup>_._</sup> <sup>15</sup> <sup>_*_</sup>
∑︀ _?_ _|??_ <sup>_?| −_</sup> _?_ ∑︀ _−_ 1 _????_ ( _??_ <sup>_?, ?_</sup> _?_ <sup>_?_</sup> +1 <sup>).</sup> <sup>We will</sup> <sup>denote this</sup>
_|??_ <sup>_?_</sup>
_?_ <sup>_?_</sup> +1 <sup>).</sup> <sup>We will</sup> <sup>denote this</sup>
_?_ <sup>_?| −_</sup>
_?_ _−_ 1
∑︀
_?_ =1
_????_ ( _??_ <sup>_?_</sup>
_?_ <sup>_?, ?_</sup> _?_ <sup>_?_</sup>
_?_ =1
<u>8</u> <u>D.V.</u> <u>Luciv,</u> <u>D.V.</u> <u>Koznov,</u> <u>G.A.</u> <u>Chernishev,</u> <u>A.N.</u> <u>Terekhov</u>
The _??????_ function selects nearby groups
for some group _?_ (its parameter). To do this,
for each text fragment from _?_ a collection of
intervals that intersect with its interval is extracted. _Text_ _fragments_ _that_ _correspond_ _to_ _these_
_intervals_ _turn_ _out_ _to_ _be_ _neighboring_ _to_ _the_ _ini-_
_tial_ _fragment_, i.e. for them, condition (5) is
satisfied. The retrieval is done using the interval tree search algorithm [40, 41]. We construct
the _??_ 1 set, which contains groups that are expected to be nearby to _?_ :
_??_ 1( _?_ ) = _{?_ <sup>_′_</sup> _|_ ( _?_ <sup>_′_</sup> _∈_ _????_ _∪_ _?????_ ) _∧_
(6)
_∃?_ _∈_ _?, ?_ <sup>_′_</sup> _∈_ _?_ <sup>_′_</sup> : _↕_ _?∩↕_ _?_ <sup>_′̸_</sup> = _∅._
That is, the _??_ 1 set consists of groups that
contain at least one duplicate that is close to
at least one duplicate from _?_ . Then, only the
groups that can form a variational group with
_?_ are selected and placed into the _??_ 2 set:
_??_ 2( _?_ ) = _{?_ <sup>_′_</sup> _|?_ <sup>_′_</sup> _∈_ _??_ 1 _∧_ ( _⟨?, ?_ <sup>_′_</sup> _⟩_ or
(7)
_⟨?_ <sup>_′_</sup> _, ?⟩_ is variational group) _}._
Finally, the _??_ 3 set (the _??????_ function’s
output) is created. The only groups placed in
this set are those from _??_ 2 whose all elements
are close to corresponding elements of _?_ :
_??_ 3( _?_ ) = _{?_ <sup>_′_</sup> _|?_ <sup>_′_</sup> _∈_ _??_ 2 _∧_
(8)
_∀?_ _∈{_ 1 _, . . .,_ # _?}_ : _↕_ _?_ <sup>_?_</sup> _∩↕_ _?_ <sup>_′?̸_</sup> = _∅}_
Theorem 1. _Suggested_ _algorithm_ _detects_ _near_
_duplicate_ _groups_ _that_ _conform_ _to_ _definition_ _9._
It is easy to show by construction of _??????_
that for some group _?_ it returns the set of its
nearby groups (see definition 11). That is, each
of these groups can be used to form a near duplicate group with _?_ . Then for the set the algorithm selects the group closest to _?_ and constructs a new near duplicate group. The correctness of all intermediate sets and other used
functions is immediate from their construction
methods.
### 5 Evaluation
The proposed algorithm was implemented in
the Duplicate Finder Toolkit [12]. Our prototype uses the `intervaltree` library [42] as an
implementation of the interval tree data structure.
We have evaluated 19 industrial documents
belonging to various types: requirement specification, programming guides, API documentation, user manuals, etc. (see Table 1). The size
of the evaluated documents is up to 3 Mb.
Our evaluation produced the following results. The majority of the duplicate groups
detected are exact duplicates (88.3–96.5%).
Groups having one variation point amount to
3.3–12.5%, two variation points - to 0–1.7%,
and three variation points - to less 1%, etc.
A few near duplicates with 11, 12 13, and 16
variation points also were detected. We performed a manual analysis of the automatically
detected near duplicates for Linux Kernel Documentation (programming guide, document 1
in the Table 1) [13]. We found 70 meaningful
text groups (5.4%), 30 meaningful groups for
the code example (2.3%), and 1191 false positive groups (92.3%). We found 21 near duplicate groups, i.e. 21% of the meaningful duplicate groups. Therefore, the share of near duplicates significantly increases after discarding
false positives.
Having analyzed the evaluation results, we
can make the following conclusions:
1. During our experiments we did not manage
to find any near duplicates in considered
documents that were not detected by our
algorithm. However, we should note that
the claim of the algorithm’s high recall
needs a more detailed justification.
2. Analyzing the Linux Kernel
Documentation, we have concluded
that it does not have any cohesive style:
it was created sporadically by different
authors. Virtually all its duplicates are
situated locally, i.e. close to each other.
For example, some author created a
description of some driver’s functionality
using copy/paste for its similar features.
At the same time, another driver was
described by a different author who did
not use the first driver’s description at
all. Consequently, there are practically no
duplicates that are found throughout the
<u>Detecting</u> <u>Near</u> <u>Duplicates</u> <u>in</u> <u>Software</u> <u>Documentation</u> <u>9</u>
<u>Table</u> <u>1:</u> <u>Near-duplicate</u> <u>groups</u> <u>detected</u>
<u>1</u> <u>892</u> <u>1291</u> <u>93.9</u> <u>5.1</u> <u>0.9</u> <u>0.2</u>
<u>2</u> <u>2924</u> <u>6056</u> <u>93.3</u> <u>5.3</u> <u>0.9</u> <u>0.2</u>
<u>3</u> <u>1810</u> <u>4220</u> <u>95.9</u> <u>3.4</u> <u>0.5</u> <u>0.2</u>
<u>4</u> <u>686</u> <u>1500</u> <u>96.5</u> <u>3.3</u> <u>0.2</u> <u>0.1</u>
<u>5</u> <u>1311</u> <u>4688</u> <u>95.9</u> <u>3.3</u> <u>0.5</u> <u>0.0</u>
<u>6</u> <u>3136</u> <u>6587</u> <u>93.9</u> <u>5.1</u> <u>0.7</u> <u>0.2</u>
<u>7</u> <u>1491</u> <u>4537</u> <u>92.0</u> <u>6.0</u> <u>1.2</u> <u>0.4</u>
<u>8</u> <u>3160</u> <u>7804</u> <u>95.6</u> <u>3.5</u> <u>0.5</u> <u>0.2</u>
<u>9</u> <u>1104</u> <u>152</u> <u>93.4</u> <u>5.3</u> <u>0.7</u> <u>0.7</u>
<u>10</u> <u>1800</u> <u>4685</u> <u>92.7</u> <u>5.8</u> <u>0.9</u> <u>0.3</u>
<u>11</u> <u>1056</u> <u>2436</u> <u>91.5</u> <u>6.7</u> <u>1.1</u> <u>0.3</u>
<u>12</u> <u>36</u> <u>59</u> <u>83.1</u> <u>11.9</u> <u>1.7</u> <u>0.0</u>
<u>13</u> <u>166</u> <u>392</u> <u>89.5</u> <u>9.7</u> <u>0.5</u> <u>0.3</u>
<u>14</u> <u>103</u> <u>208</u> <u>91.3</u> <u>7.7</u> <u>0.5</u> <u>0.0</u>
<u>15</u> <u>98</u> <u>117</u> <u>94.0</u> <u>4.3</u> <u>0.9</u> <u>0.9</u>
<u>16</u> <u>241</u> <u>394</u> <u>88.8</u> <u>9.1</u> <u>0.8</u> <u>0.3</u>
<u>17</u> <u>43</u> <u>16</u> <u>81.3</u> <u>12.5</u> <u>6.3</u> <u>0.0</u>
<u>18</u> <u>50</u> <u>77</u> <u>88.3</u> <u>11.7</u> <u>0.0</u> <u>0.0</u>
<u>19</u> <u>167</u> <u>145</u> <u>88.3</u> <u>9.7</u> <u>0.7</u> <u>1.4</u>
whole text. Examples, warnings, notes,
and other documentation elements that
are preceded by different introductory
sentences are not styled cohesively as
well. Thus, our algorithm can be used for
analyzing the degree of documentation
uniformity.
3. The algorithm performs well on twoelement groups, finding near duplicate
groups with a different number of
extension points. It appears that, in
general, there are way fewer near duplicate
groups with more than two elements.
4. Many detected duplicate groups consist of
figure and table captions, page headers,
parts of the table of contents and so
on - that is, they are not of any
interest to us. Also, many found duplicates
are scattered across different elements
of document structure, for example, a
duplicate can be a part of a header
and a small fragment of text right after
it. These kinds of duplicates are not
desired since they are not very useful
for document writers. However, they
are detected because currently document
structure is not taken into account during
the search.
5. The 0.15 value used in detecting near
duplicate groups does not allow to find
some significant groups (mainly small
ones, 10–20 tokens in size). It is possible
that it would be more effective to use some
function instead of a constant, which could
depend, for example, on the length of the
near duplicate.
6. Moreover, often the detected duplicate
does not contain variational information
that is situated either in its end or
in its beginning. Sometimes it could
be beneficial to include it in order to
ensure semantic completeness. To solve
this problem, a clarification and a formal
definition of semantic completeness of a
text fragment is required. Our experiments
show that this can be done in various ways
(the simplest one is ensuring sentence-level
granularity, i.e. including all text until the
start/end of sentence).
<u>10</u> <u>D.V.</u> <u>Luciv,</u> <u>D.V.</u> <u>Koznov,</u> <u>G.A.</u> <u>Chernishev,</u> <u>A.N.</u> <u>Terekhov</u>
### 6 Conclusion
In this paper the formal definition of near duplicates in software documentation is given and
the algorithm for near duplicate detection is
presented. An evaluation of the algorithm using a large number of both commercial and
open source documents is performed.
The evaluation shows that various types
of software documentation contain a significant number of exact and near duplicates. A
near duplicate detection tool could improve the
quality of documentation, while a duplicate
management technique would simplify documentation maintenance.
Although the proposed algorithm provides
ample evidence on text duplicates in industrial
documents, it still requires improvements before it can be applied to real-life tasks. The
main issues to be resolved are the quality of
the near duplicates detected and a large number of false positives. Also, a detailed analysis
of near duplicate types in various sorts of software documents should be performed.
### References
[1] Parnas D.L. _Precise_ _Documentation:_
_The_ _Key_ _to_ _Better_ _Software_ . Springer
Berlin Heidelberg, Berlin, Heidelberg,
2011, pp. 125–148. DOI: 10.1007/
978-3-642-15187-3_8.
[2] Juergens E., Deissenboeck F., Feilkas M.,
Hummel B., Schaetz B., Wagner S., Domann C., and Streit J. Can clone detection support quality assessments of requirements specifications? _Proceedings_
_of_ _ACM/IEEE_ _32nd_ _International_ _Con-_
_ference_ _on_ _Software_ _Engineering_, vol. 2.
2010, pp. 79–88. DOI: 10.1145/1810295.
1810308.
[3] Nos´al’ M. and Porub¨an J. Preliminary re
port on empirical study of repeated fragments in internal documentation. _Proceed-_
_ings of Federated Conference on Computer_
_Science_ _and_ _Information_ _Systems_ . 2016,
pp. 1573–1576.
[4] Koznov D.V. and Romanovsky K.Y. Do
cLine: A method for software product
lines documentation development. _Pro-_
_gramming and Computer Software_, vol. 34,
no. 4, 2008, pp. 216–224. DOI: 10.1134/
S0361768808040051.
[5] Romanovsky K., Koznov D., and Minchin
L. Refactoring the Documentation of
Software Product Lines. _Lecture_ _Notes_
_in_ _Computer_ _Science_, _CEE-SET_ _2008_,
vol. 4980. Springer-Verlag, Berlin, Heidelberg, 2011, pp. 158–170. DOI: 10.1007/
978-3-642-22386-0_12.
[6] Wingkvist A., Lowe W., Ericsson M., and
Lincke R. Analysis and visualization of information quality of technical documentation. _Proceedings of the 4th European Con-_
_ference_ _on_ _Information_ _Management_ _and_
_Evaluation_ . 2010, pp. 388–396.
[7] Nos´al’ M. and Porub¨an J. Reusable soft
ware documentation with phrase annotations. _Central_ _European_ _Journal_ _of_ _Com-_
_puter_ _Science_, vol. 4, no. 4, 2014, pp. 242–
258. DOI: 10.2478/s13537-014-0208-3.
[8] Koznov D., Luciv D., Basit H.A., Lieh
O.E., and Smirnov M. Clone Detection in
Reuse of Software Technical Documentation. _International_ _Andrei_ _Ershov_ _Memo-_
_rial_ _Conference_ _on_ _Perspectives_ _of_ _Sys-_
_tem_ _Informatics_ _(2015)_, _Lecture_ _Notes_ _in_
_Computer_ _Science_, vol. 9609. Springer Nature, 2016, pp. 170–185. DOI: 10.1007/
978-3-319-41579-6_14.
[9] Luciv D.V., Koznov D.V., Basit H.A.,
and Terekhov A.N. On fuzzy repetitions
detection in documentation reuse. _Pro-_
_gramming and Computer Software_, vol. 42,
no. 4, 2016, pp. 216–224. DOI: 10.1134/
s0361768816040046.
[10] Basit H.A., Puglisi S.J., Smyth W.F.,
Turpin A., and Jarzabek S. Efficient Token Based Clone Detection with Flexible Tokenization. _Proceedings_ _of_ _the_ _6th_
_Joint_ _Meeting_ _on_ _European_ _Software_ _En-_
_gineering_ _Conference_ _and_ _the_ _ACM_ _SIG-_
_SOFT_ _Symposium_ _on_ _the_ _Foundations_ _of_
<u>Detecting</u> <u>Near</u> <u>Duplicates</u> <u>in</u> <u>Software</u> <u>Documentation</u> <u>11</u>
_Software Engineering:_ _Companion Papers_ .
ACM, New York, NY, USA, 2007, pp. 513–
516. DOI: 10.1145/1295014.1295029.
[11] Bassett P.G. _Framing_ _Software_ _Reuse:_
_Lessons_ _from_ _the_ _Real_ _World_ . PrenticeHall, Inc., Upper Saddle River, NJ, USA,
1997.
[12] Documentation Refactoring Toolkit.
URL: `[http://www.math.spbu.ru/user/](http://www.math.spbu.ru/user/kromanovsky/docline/index_en.html)`
`[kromanovsky/docline/index_en.html](http://www.math.spbu.ru/user/kromanovsky/docline/index_en.html)` .
[13] Torvalds L. Linux Kernel Documentation, Dec 2013 snapshot. URL: `[https:](https://github.com/torvalds/linux/tree/master/Documentation/DocBook/)`
```
//github.com/torvalds/linux/tree/
```
`[master/Documentation/DocBook/](https://github.com/torvalds/linux/tree/master/Documentation/DocBook/)` .
[14] Horie M. and Chiba S. Tool Support for
Crosscutting Concerns of API Documentation. _Proceedings_ _of_ _the_ _9th_ _International_
_Conference_ _on_ _Aspect-Oriented_ _Software_
_Development_ . ACM, New York, NY, USA,
2010, pp. 97–108. DOI: 10.1145/1739230.
1739242.
[15] Rago A., Marcos C., and Diaz-Pace J.A.
Identifying duplicate functionality in textual use cases by aligning semantic actions.
_Software_ _&_ _Systems_ _Modeling_, vol. 15,
no. 2, 2016, pp. 579–603. DOI: 10.1007/
s10270-014-0431-3.
[16] Huang T.K., Rahman M.S., Madhyastha
H.V., Faloutsos M., and Ribeiro B. An
Analysis of Socware Cascades in Online Social Networks. _Proceedings_ _of_ _the_
_22Nd_ _International_ _Conference_ _on_ _World_
_Wide_ _Web_ . ACM, New York, NY, USA,
2013, pp. 619–630. DOI: 10.1145/2488388.
2488443.
[17] Williams K. and Giles C.L. Near Duplicate Detection in an Academic Digital
Library. _Proceedings_ _of_ _the_ _ACM_ _Sym-_
_posium_ _on_ _Document_ _Engineering_ . ACM,
New York, NY, USA, 2013, pp. 91–94.
DOI: 10.1145/2494266.2494312.
[18] Zhang Q., Zhang Y., Yu H., and Huang
X. Efficient Partial-duplicate Detection
Based on Sequence Matching. _Proceed-_
_ings_ _of_ _the_ _33rd_ _International_ _ACM_ _SI-_
_GIR Conference on Research and Develop-_
_ment in Information Retrieval_ . ACM, New
York, NY, USA, 2010, pp. 675–682. DOI:
10.1145/1835449.1835562.
[19] Abdel Hamid O., Behzadi B., Christoph
S., and Henzinger M. Detecting the Origin of Text Segments Efficiently. _Pro-_
_ceedings_ _of_ _the_ _18th_ _International_ _Con-_
_ference_ _on_ _World_ _Wide_ _Web_ . ACM, New
York, NY, USA, 2009, pp. 61–70. DOI:
10.1145/1526709.1526719.
[20] Ramaswamy L., Iyengar A., Liu L., and
Douglis F. Automatic Detection of Fragments in Dynamically Generated Web
Pages. _Proceedings_ _of_ _the_ _13th_ _Interna-_
_tional_ _Conference_ _on_ _World_ _Wide_ _Web_ .
ACM, New York, NY, USA, 2004, pp. 443–
454. DOI: 10.1145/988672.988732.
[21] Gibson D., Punera K., and Tomkins A.
The Volume and Evolution of Web Page
Templates. _Special_ _Interest_ _Tracks_ _and_
_Posters_ _of_ _the_ _14th_ _International_ _Confer-_
_ence_ _on_ _World_ _Wide_ _Web_ . ACM, New
York, NY, USA, 2005, pp. 830–839. DOI:
10.1145/1062745.1062763.
[22] Vall´es E. and Rosso P. Detection of Near
duplicate User Generated Contents: The
SMS Spam Collection. _Proceedings_ _of_ _the_
_3rd International Workshop on Search and_
_Mining_ _User-generated_ _Contents_ . ACM,
New York, NY, USA, 2011, pp. 27–34.
DOI: 10.1145/2065023.2065031.
[23] Barr´on-Cede˜no A., Vila M., Mart´ı M., and
Rosso P. Plagiarism Meets Paraphrasing:
Insights for the Next Generation in Automatic Plagiarism Detection. _Comput. Lin-_
_guist._, vol. 39, no. 4, 2013, pp. 917–947.
DOI: 10.1162/COLI_a_00153.
[24] Smyth W. _Computing Patterns in Strings_ .
Addison-Wesley, 2003.
[25] Levenshtein V. Binary codes capable of
correcting spurious insertions and dele
<u>12</u> <u>D.V.</u> <u>Luciv,</u> <u>D.V.</u> <u>Koznov,</u> <u>G.A.</u> <u>Chernishev,</u> <u>A.N.</u> <u>Terekhov</u>
tions of ones. _Problems_ _of_ _Information_
_Transmission_, vol. 1, 1965, pp. 8–17.
[26] Wagner R.A. and Fischer M.J. The String
to-String Correction Problem. _Journal_ _of_
_the ACM_, vol. 21, no. 1, 1974, pp. 168–173.
DOI: 10.1145/321796.321811.
[27] Wu S. and Manber U. Fast Text Searching:
Allowing Errors. _Commun._ _ACM_, vol. 35,
no. 10, 1992, pp. 83–91. DOI: 10.1145/
135239.135244.
[28] Myers G. A Fast Bit-vector Algorithm for
Approximate String Matching Based on
Dynamic Programming. _J._ _ACM_, vol. 46,
no. 3, 1999, pp. 395–415. DOI: 10.1145/
316542.316550.
[29] Broder A. On the Resemblance and Con
tainment of Documents. _Proceedings_ _of_
_the_ _Compression_ _and_ _Complexity_ _of_ _Se-_
_quences_ . IEEE Computer Society, Washington, DC, USA, 1997, pp. 21–29.
[30] Wang P., Xiao C., Qin J., Wang W.,
Zhang X., and Ishikawa Y. Local Similarity Search for Unstructured Text. _Pro-_
_ceedings_ _of_ _International_ _Conference_ _on_
_Management_ _of_ _Data_ . ACM, New York,
NY, USA, 2016, pp. 1991–2005. DOI:
10.1145/2882903.2915211.
[31] Sajnani H., Saini V., Svajlenko J., Roy
C.K., and Lopes C.V. SourcererCC: Scaling Code Clone Detection to Big-code.
_Proceedings of the 38th International Con-_
_ference_ _on_ _Software_ _Engineering_ . ACM,
New York, NY, USA, 2016, pp. 1157–1168.
DOI: 10.1145/2884781.2884877.
[32] Jiang L., Misherghi G., Su Z., and Glondu
S. DECKARD: Scalable and Accurate
Tree-Based Detection of Code Clones.
_Proceedings of the 29th International Con-_
_ference_ _on_ _Software_ _Engineering_ . IEEE
Computer Society, Washington, DC, USA,
2007, pp. 96–105. DOI: 10.1109/ICSE.
2007.30.
[33] Indyk P. and Motwani R. Approximate
Nearest Neighbors: Towards Removing
the Curse of Dimensionality. _Proceed-_
_ings_ _of_ _the_ _Thirtieth_ _Annual_ _ACM_ _Sym-_
_posium_ _on_ _Theory_ _of_ _Computing_, STOC
’98. ACM, New York, NY, USA, 1998.
ISBN 0-89791-962-9, pp. 604–613. DOI:
10.1145/276698.276876. URL: `[http://](http://doi.acm.org/10.1145/276698.276876)`
`[doi.acm.org/10.1145/276698.276876](http://doi.acm.org/10.1145/276698.276876)` .
[34] Cordy J.R. and Roy C.K. The NiCad
Clone Detector. _Proceedings_ _of_ _IEEE_
_19th International Conference on Program_
_Comprehension_ . 2011, pp. 219–220. DOI:
10.1109/ICPC.2011.26.
[35] Rattan D., Bhatia R., and Singh M. Soft
ware clone detection: A systematic review. _Information_ _and_ _Software_ _Technol-_
_ogy_, vol. 55, no. 7, 2013, pp. 1165–1199.
DOI: 10.1016/j.infsof.2013.01.008.
[36] Abouelhoda M.I., Kurtz S., and Ohlebusch
E. Replacing Suffix Trees with Enhanced
Suffix Arrays. _J._ _of_ _Discrete_ _Algorithms_,
vol. 2, no. 1, 2004, pp. 53–86. DOI: 10.
1016/S1570-8667(03)00065-0.
[37] Koznov D.V., Shutak A.V., Smirnov
M.N., and A. S.M. Clone detection in
refactoring software documentation [Poisk
klonov pri refaktoringe tehnicheskoj dokumentacii]. _Computer_ _Tools_ _in_ _Educa-_
_tion_ _[Komp’juternye_ _instrumenty_ _v_ _obra-_
_zovanii]_, vol. 4, 2012, pp. 30–40. (In Russian).
[38] Bassett P.G. The Theory and Practice of
Adaptive Reuse. _SIGSOFT_ _Softw._ _Eng._
_Notes_, vol. 22, no. 3, 1997, pp. 2–9. DOI:
10.1145/258368.258371.
[39] Jarzabek S., Bassett P., Zhang H., and
Zhang W. XVCL: XML-based Variant
Configuration Language. _Proceedings_ _of_
_the 25th International Conference on Soft-_
_ware_ _Engineering_ . IEEE Computer Society, Washington, DC, USA, 2003, pp. 810–
811.
[40] de Berg M., Cheong O., van Kreveld M.,
and Overmars M. chapter Interval Trees.
Springer Berlin Heidelberg, 2008, pp. 220–
226. DOI: 10.1007/978-3-540-77974-2.
<u>Detecting</u> <u>Near</u> <u>Duplicates</u> <u>in</u> <u>Software</u> <u>Documentation</u> <u>13</u>
[41] Preparata F.P. and Shamos M.I. chapter Intersections of rectangles. Texts
and Monographs in Computer Science.
Springer, 1985, pp. 359–363.
[42] PyIntervalTree. URL: `[https://github.](https://github.com/chaimleib/intervaltree)`
`[com/chaimleib/intervaltree](https://github.com/chaimleib/intervaltree)` .
섹션 본문
섹션 본문이 없습니다.
참고문헌
참고문헌 정보가 없습니다.