<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>CodEX: Source Code Plagiarism Detection Based on Abstract Syntax Trees</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Mengya Zheng</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Xingyu Pan</string-name>
          <email>xingyu.pang@ucdconnect.ie</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>David Lillis</string-name>
          <email>david.lillis@ucd.ie</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Beijing Dublin International College, University College Dublin</institution>
          ,
          <country country="IE">Ireland</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>School of Computer Science, University College Dublin</institution>
          ,
          <country country="IE">Ireland</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>CodEX is a source code search engine that allows users to search a repository of source code snippets using source code snippets as the query also. A potential use for such a search engine is to help educators identify cases of plagiarism in students' programming assignments. This paper evaluates CodEX in this context. Abstract Syntax Trees (ASTs) are used to represent source code les on an abstract level. This, combined with node hashing and similarity calculations, allows users to search for source code snippets that match suspected plagiarism cases. A number of commonly-employed techniques to avoid plagiarism detection are identi ed, and the CodEX system is evaluated for its ability to detect plagiarism cases even when these techniques are employed. Evaluation results are promising, with 95% of test cases being identi ed successfully.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>CodEX is a general-purpose search engine to allow users to search for source
code snippets, developed as part of an undergraduate nal year project. The
user interface supports three di erent methods providing queries to the system:
{ keyword-based search: obtains keywords from the user and returns source
les relevant to these keywords from GitHub3.
{ description-based search: allows users to input questions or descriptions of
code, and returns relevant StackOver ow4 answers to similar questions.
{ source code snippet search: obtains a complete source code structure (code
snippet) from the user, and returns source les containing similar code
snippets from GitHub.</p>
      <p>One potential use for the source code snippet search feature is the detection
of plagiarism among programming assignments. Given a repository of existing
source code, a suspected case of plagiarism can be used as a search snippet, with
CodEX providing a list of similar code snippets. This paper focuses on this use</p>
      <sec id="sec-1-1">
        <title>3 https://github.com 4 http://stackoverflow.com/</title>
        <p>case, in the context of ve common tactics used by students to avoid detection
and a combination of these.</p>
        <p>Due to the syntax di erences of variant source code languages, di erent APIs
or supporting external classes are needed to implement the source code snippet
searching feature. CodEX applies a general algorithm based on Abstract Syntax
Trees (ASTs) to solve this problem. Initially, Python and Java code snippets
were chosen as examples, since their AST structures vary to some degree.
Successfully applying this approach to multiple languages indicates the potential for
extending the system to other programming languages in the future.</p>
        <p>In Section 2 of this paper, related work is listed and discussed with
comparison to CodEX; in Section 3, the implementation approach of the source code
snippet search feature is illustrated in detail; evaluation results are displayed in
Section 4 with brief analysis; the last section draws conclusions and outlines the
future work of this project.
2</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>Related Work</title>
      <p>
        Multiple code search engines already exist that support keyword-based
searching in multiple programming languages, such as searchcode5, codas6, unspsc7,
Debian8. etc. CodEX distinguishes itself from these through its code-snippet
searching module and plagiarism detection. Regarding code snippet searching,
there are already several pioneers who have achieved high performance in this
area [
        <xref ref-type="bibr" rid="ref14 ref2 ref6">6, 14, 2</xref>
        ]. A good example is Sourcerer [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], which breaks down each piece of
code into di erent entities, uniquely identi able elements from the source code,
and then abstract these entities into ngerprints. To integrate these entities into
an organic whole, relations between these entities' ngerprints are recorded.
      </p>
      <p>
        Other variations of ngerprinting are frequently proposed by Information
Retrieval researchers. Among these, Syntax Tree Fingerprinting [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], is a signi cant
inspiration for the implementation of CodEX. In this work, ngerprints were
used to represent nodes of Abstract Syntax Tree [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. These ngerprints contain
a weight, a hash value and other important information of the node for code
snippet comparison. Based on this research, CodEX combines several useful and
portable techniques including AST, entity division, node weight and hash values
to implement the code-snippet searching algorithm, while sacri cing some less
important information such like entity relations and other elds in Syntax tree
ngerprints as they can be suggested by the hierarchical structure of AST.
      </p>
      <p>
        Regarding plagiarism among programming assignments, multiple commonly
used techniques for avoiding plagiarism detection should be considered when
developing source code plagiarism detection tools [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. To deal with these techniques,
several pioneers have achieved high performance in their work. One example is
a ngerprinting approach called Winnowing [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ], which divides source code into
5 http://searchcode.com
6 http://www.codase.com
7 http://www.unspsc.org/search-code
8 https://codesearch.debian.net
k-grams (where k is chosen by users), and chooses a subset of these k-grams for
comparison based on their hash values. This approach sacri ces full comparison
between source les to achieve high e ciency. Al-Khanjari et al. [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] developed
a Java program plagiarism detection tool that applied Attribute Counting
Metrics (ATMs) [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]. This was illustrated to be less e ective than the structural
metrics employed by Kristina and Wise [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ], as structural information is more
important for source les. Greenan [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] applied the length of the longest common
subsequence (LCS) algorithm [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] to calculate a similarity score between two
method-level code snippets in a line-by-line manner, which gives positive points
for matching lines and negative points for mismatching lines. This method works
well for method-level code comparison because the types of code structures are
known to be the same, and additional signi cant information such like method
names, parameters and return types are easy to record as independent elds.
However, it is di cult to abstract all the signi cant information of an entire
source le and store them in independent elds. Moreover, the code structures
of two compared code snippets are unknown and possibly di erent, making it
impossible to compare them line-by-line.
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>Methods</title>
      <p>
        In this section, the idea and advantages of ASTs are discussed in detail initially.
Following this, a number of techniques are identi ed in Section 3.2 that are
frequently used by students to avoid plagiarism detection. The implementation
strategy for code snippet searching is then demonstrated in Section 3.3.
3.1
As an abstract form of source code structure, ASTs capture the structural
features of code snippets and represent them in a hierarchical tree structure.
Compared to Concrete Syntax Trees (CSTs) [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ], another type of syntax tree used
to give an exact representation of source code, ASTs are more suitable for code
snippet searching because they represent source code at an abstract level where
unimportant elements such as grammar symbols can be ignored as noise.
Therefore, only the structure and general meaning of source les are considered for
comparison.
      </p>
      <p>
        This advantage makes a signi cant di erence for the implementation: AST
node types and attributes are classi ed to declare the component usage and
function, which allows noise to be removed easily. The fact that ASTs translate
the structure of source code into parent-child or sibling relationships among tree
nodes enables the e cient depth- rst top-to-bottom traversal strategy [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. To
support code snippet searching for Java and Python, two supporting tools are
required. Firstly, the Python AST API9 is used to process Python source le.
Secondly, Javalang10 is a package implemented in Python that provides AST
      </p>
      <sec id="sec-3-1">
        <title>9 https://docs.python.org/3/library/ast.html 10 https://pypi.org/project/javalang/</title>
        <p>generators for Java source les. As Javalang is not a fully-developed AST API,
it was necessary to implement additional methods to ful ll necessary analysis
for Java source les.
3.2</p>
        <sec id="sec-3-1-1">
          <title>Techniques for Avoiding Plagiarism Detection</title>
          <p>
            In developing this module, it was necessary to identify methods that students use
to avoid plagiarism detection. Additionally, certain di erences between source
code submissions would have no e ect on the overall functionality of the code,
but would cause a simple matching algorithm to fail. Six diverse techniques were
initially identi ed for particular focus, as follows:
{ output statement insertion/removal : inserting or removing output
statements (e.g. \print" in Python) are inserted into the original code.
{ comments insertion/removal : inserting or removing comments to the original
code.
{ identi er name modi cation: modifying identi er names (variable names,
method names, class names etc.).
{ change code order : changing the order of some pieces of source code to avoid
plagiarism detection (e.g. changing the order of function declarations).
However, only order changes between sibling nodes are relevant to this technique,
while those between parent-child nodes are not plagiarism techniques as they
have a functional e ect on the source le.
{ combine multiple code blocks from multiple source les : copying multiple
code blocks from di erent source les where each piece of copied code is not
serious enough to be de ned as plagiarism. This technique cannot be easily
detected by traditional source code search engines which simply evaluate the
similarity between the input code and individual source les.
{ meaningless code insertion: this is the trickiest plagiarism technique that
challenges plenty of researchers in the eld [
            <xref ref-type="bibr" rid="ref9">9</xref>
            ]. It is di cult to de ne what
kind of code is \meaningless", as this description is fuzzy. To give it a clearer
description, \meaningless" code includes those code without any functional
e ect on the source le, e.g. unused variable declaration statements, code
blocks that are never reached.
3.3
          </p>
        </sec>
        <sec id="sec-3-1-2">
          <title>Implementation</title>
          <p>The implementation of the source code snippet search feature follows the
classical information retrieval process: preprocessing, indexing, searching. These are
addressed in the following sections.</p>
          <p>Source File Pre-processing As is shown in Figure 1, in the pre-processing
phase, the source code snippets are rstly parsed into ASTs. Next, some noise
(unimportant nodes in green) is removed from these trees. Some plagiarism
techniques related to noise are detected during this step. Here, four types of noise
are removed: identi er names, inner documents (comments), output statements
and unused variables. These unimportant nodes are pruned from Python ASTs
and Java ASTs with di erent strategies.</p>
          <p>For the cleaning step in Python source les, a \visitor" is implemented to
traverse the AST of each code snippet and invoke diverse removal operations
on di erent types of noise. This visitor is an instance of a class
implementing the abstract NodeTransformer class provided by Python AST API. In this
class, multiple methods are de ned and implemented for di erent types of nodes
to make modi cations to their attribute values and return the modi ed nodes.
These methods are implemented as lters for source les. For each type of noise,
there is a speci c lter implemented in the visitor to remove it from the original
nodes. When removing the identi er names, only those identi er names de ned
within the code snippets are removed but those standard class/method names
de ned by external classes are retained as they have a functional e ect on the
source les. Next, all the code snippets are serialized as Strings in nested lists to
represent the hierarchical structures. However, for Java source le code
cleaning, it was necessary to implement additional serialization and noise cleaning
strategies as they are not provided or directly supported by Javalang.</p>
          <p>Unused variables, the variables that are de ned or initialized but never called
in the source le are also detected in this phase, as they are regarded as one
category of meaningless elements. However, removing them demands another
traversal of the entire tree as the list of unused variables can only be obtained
after the rst traversal. Early experimentation indicated that the time required
for this process was excessive and so it was removed from the current version
of the system in order to improve the response time for users. Including a more
e cient implementation is left to future work, which assumes more available
computational resources.</p>
          <p>In summary, noise cleaning is performed during the preprocessing phases for
both Python and Java, after which the output insertion/removal, inner
documents (comment) insertion/removal and identi er name modi cations
techniques are all addressed. Also, a partial solution to the \meaningless code
insertion" problem is also proposed and demonstrated in this phase. Therefore,
what has been left to the latter phases are those plagiarism techniques involving
structural modi cations.</p>
          <p>
            Indexing In the indexing phase, the cleaned source code is represented by
appropriate data structures for further comparison and calculation. As Figure 1
shows, after the preprocessing phase, the source les have been cleaned and
turned into pruned ASTs. Nevertheless, there are still some steps to execute
before the similarity calculation. To summarise this process: rstly, a ngerprint
is generated for each tree nodes to represent its relevant information. In order to
avoid redundancy, not all nodes need to be analyzed and stored; instead, only
important nodes are stored for further comparison. Therefore, a benchmark
determining what constitutes an \important" node nodes is determined, which also
re ects the granularity of code snippet searching algorithms. Secondly,
following the suggestion in [
            <xref ref-type="bibr" rid="ref10">10</xref>
            ], a weight is associated with each ngerprint in order
to measure each node's contribution to the similarity calculation. Hence, the
weight information of all code components needs to be calculated and recorded
during the indexing phase. Thirdly, to show users the matching areas between
two source les, line numbers and node weights are calculated during each
recursion of the serialization step as this information is not fully provided by the
AST APIs or other supporting classes. As displayed in Figure 1, these weights are
stored along with the ngerprints and the nodes' hash values. Next, all sibling
nodes are sorted in each abstract syntax tree in order to deal with the
orderchange plagiarism technique. Finally, the source les in the corpus are indexed to
di erent data structures, which has a substantial e ect on the time complexity
in searching phase.
          </p>
          <p>
            These three key tasks in the indexing phase are discussed in detail as follows:
1. Node Hashing Granularity: As mentioned above, in the indexing phase,
the code snippet is decomposed into relatively ne-grained code components
of diverse granularity. Here, \relatively ne-grained" means that the code
structure is decomposed thoroughly enough to expose all matching elements,
while some tiny elements such as constants and parameters are not
decomposed as independent nodes to avoid a cumbersome comparison process. This
does not mean that these tiny elements will be ignored but they are
contained within some bigger nodes. However, now that tiny elements need to
be treated in a di erent way, a speci c benchmark deciding what elements
are \tiny" should be determined in advance. This benchmark is essential
because it also determines the granularity of the indexing phase, which directly
a ects the accuracy and e ciency of the search algorithm. Inspired by the
code clone detection research of Nilsson et al. [
            <xref ref-type="bibr" rid="ref11">11</xref>
            ] and Chilowicz's syntax
tree ngerprinting method [
            <xref ref-type="bibr" rid="ref4">4</xref>
            ], a speci c weight threshold is pre-de ned as
this benchmark. As demonstrated in Figure 1, all the nodes with weights
below this threshold are regarded as \tiny" nodes. After empirical testing,
this threshold was set to 10, which had the e ect of ltering nodes such as
simple variable declarations and short Boolean operations. It is likely that
this threshold will be di erent for other source languages. AST nodes with
weights above the threshold are stored in as ngerprints, which consist of
their weight, line number information and hash values. Before hashing, the
serialized form of an abstract syntax tree is a long string containing all nodes'
information in its nested structure. The hashing step turns these long strings
into uniquely-compressed Strings of xed length, thus facilitating the time
e ciency of further code comparison as the lengths of compared strings have
been shortened to a same xed value.
2. Sibling Sorting: A change in order between sibling nodes may frequently
have no functional e ect on a code snippet, in contrast to parent-child node
pairs. However, this feature can be exploited to avoid plagiarism detection.
For example, function de nitions are siblings and their ordering does not
a ect the execution of the program, but changing their order would fool
some text-based plagiarism detection approaches. Therefore, sibling nodes
need to be re-arranged to tackle relative plagiarism techniques. Hence all
sibling node lists are sorted.
3. Index Structures: In Chilowicz's ngerprinting method [
            <xref ref-type="bibr" rid="ref4">4</xref>
            ], all the subtrees
are classi ed based on their weights and sorted in decreasing order, enabling a
top-to-bottom comparison between code snippets in which high-level nodes
are compared before their child nodes are checked. This method avoided
having to make comparisons between small subtrees in the bottom level,
however it did not achieve high time e ciency. The main factor lowering the
e ciency is the plain structure of code snippets, where all node ngerprints
are classi ed into separated lists mapping to their corresponding weights
(Sorted Fingerprints in Figure 1). This structure ignores the tree hierarchies
and leads to repetitive comparison between subtrees of the same weight. In
order to facilitate the time e ciency of code snippet comparison process, the
hierarchical structure is restored in the structure used to represent queries,
which enable an e cient depth- rst traversing algorithm for the searching
phase.
          </p>
          <p>Searching To search for suspected plagiarism cases, the user supplies a program
or code snippet. This is passed through two di erent search strategies. Firstly,
the query code is compared with all code snippets in the index to obtain a
similarity score for each. The output of the search is a ranked list of code snippets
from the index based on their similarity to a query code snippet.Secondly, a
global similarity score is computed, by comparing the query to the corpus as a
whole. Those snippets from the corpus that have contributed to this global score
(assuming a suspected plagiarism case has been detected) are made available to
the user. Given that plagiarism detection requires a manual judgment (not all
similar code is plagiarised), these search outputs are aimed at providing the user
with the most likely sources of plagiarised code.</p>
          <p>Local Similarity Matching (weight-based depth rst search): Figure 2 shows the
mechanism for calculating local similarities. The similarity score is calculated
during depth- rst traversal through a nested query ngerprint. This query
ngerprint is represented as a tree in this diagram, as it is based on an abstract
form of its original AST hierarchy.</p>
          <p>
            The rst step is to search the weight of current query node within the indexed
dictionary of the corpus, in which each di erent weight is a key mapping to
a list of corresponding node ngerprints. The corresponding ngerprint list is
extracted out for comparison. Next, the second step is the comparison between
the hash values of the query nodes and that of all nodes in the list. In this stage,
a matching judgment is made to each node in the ngerprint list, and invokes
two branches A and B for further processing:
{ Branch A: If some node in the ngerprint list has the same hash value as
the this query node, then this judgment goes to the Branch A (the green
branch in the diagram), where the similarity score is increased by the weight
of the matching node. After the similarity score is updated, the subtree
derived from this query node is pruned from the query tree in the third step
(A3). The tree-pruning step aims to avoid further unnecessary comparison
between its subnodes and the corpus, since the matching of current query
node also implies matching of all its subtrees. This is why in the searching
phase the nested indexed structure can achieve higher time e ciency than
plain indexed structure proposed in [
            <xref ref-type="bibr" rid="ref4">4</xref>
            ] (because tree pruning cannot be done
to the at index structure). After step A3, another recursion is triggered for
the next node. This new node can have the same weight as the last one, which
means that they are in the same list mapped to one weight, whereupon there
is no need to search the node weight in the corpus ngerprint list again. By
contrast, if the new node has a smaller weight than the previous node, it
needs to be searched in the ngerprint list again.
{ Branch B: If there is no node in the ngerprint list with the same hash
value as the query node, Branch B is triggered (the red branch in the
diagram). In this branch, whether the sub-nodes of the current query node can
nd a matching target in further recursions is unknown as no match is found
in current recursion. Therefore no subtree-pruning step is required in this
branch. Therefore, new recursions are triggered in step B3. In new
recursions, the target weight becomes smaller and is searched within the corpus
dictionary again, after which the same procedures happen to the new query
node.
          </p>
          <p>After the traversal is complete, a similarity score is calculated as the total
weight of matching code blocks from each source le in the corpus. A threshold
is pre-de ned to indicate whether a similarity score is high enough to indicate
a suspected plagiarism case. The similarity scores are normalised as the
proportion of the matching weight over the total weight of query code snippet to avoid
snippet length having an impact. The suspected plagiarism threshold must
consequently lie between 0 and 1. Empirical testing resulted in a threshold of 0.6
being identi ed. Although this threshold achieved good accuracy, it still needs
to be tuned with more test cases in the future stages for higher accuracy.
Global Similarity &amp; Matching Block Threshold: Global similarity is the similarity
score between the query code snippet and the whole corpus, which is di erent
from the similarity between each single source le in the corpus (local similarity)
as there is only one global similarity score for each query. The aim of global
similarity is to detect plagiarism queries with multiple copied code blocks from the
di erent sources, which cannot be shown by local similarity when each copied
code block is not big enough to be de ned as plagiarism. However, this global
similarity makes false positives more likely, as a query may have a high global
similarity based on matching many small code snippets throughout the corpus.
To avoid this issue, only \big" matching code blocks are used in the global
similarity calculation. Therefore, another threshold needs to be set for de ning \big"
matching blocks (called the \blockThreshold"). This threshold is based on the
weight of a code block, and empirical testing indicates that a weight of 50 is
suitable. This had the e ect of ltering out scattered small pieces of code blocks
while retaining complete code structures such as big loops and methods. In
addition, at most one matching block is taken from a source le to calculate the
global similarity. This is to avoid de ning normal queries with multiple
scattered matching blocks as plagiarism. Therefore, among all matching blocks from
each source le, the matching code block with the highest weight is selected to
contribute to the global similarity calculation.</p>
          <p>After all matching blocks are gathered, the sum of the weight of these code
blocks is calculated. Next, the similarity score is normalised as the proportion
of this sum over the total weight of query code. Finally, this global similarity
score is compared with the pre-de ned plagiarism threshold. If the threshold
is exceeded, this query is suspected to have copied blocks from multiple source
les, and these component source les are marked in the result list.
4</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Results</title>
      <p>To evaluate the accuracy of the code-snippet searching function and the
reliability of its plagiarism detection functionality, both original code snippets and
plagiarism code snippets were input to this searching module as test cases. For
each of the techniques to avoid plagiarism detection identi ed in Section 3.2, 10
pairs of original &amp; \plagiarised" code snippets were designed using
corresponding techniques. Of these, 5 pairs of test cases are in Python and the other 5 are
in Java. Additionally, 10 cases were also created whereby a mixture of all the
individual techniques were employed.</p>
      <p>Fig. 3. Source Code Plagiarism Detection Searching Evaluation Results.</p>
      <p>Firstly, in the context of code searching in general, no false-positive issue
was observed in the evaluated results. Despite the abstractions used in
searching, only source les containing similar code snippets are returned, in which
the matching lines between the input query and source les are highlighted for
comparison. For most test cases, the returned results ranked in the top 10 all
contain multiple matching lines. For some other tested code snippets, there are
only 7 or 8 returned results containing matching lines, and these test cases are all
self-designed structures that are not commonly used. In general, the code-usage
searching function achieves precision of 0.84 and is proved to be helpful to nd
the relative usage of query code snippets.</p>
      <p>Regarding the plagiarism detection function, as Figure 3 shows, all similarity
scores assigned to plagiarism test cases purely applying identi er name modi
cations, output insertions and sibling-code-order changes are 1. which suggests
that these techniques are unlikely to succeed in avoiding plagiarism detection in
the CodEX system. For the \combining multiple code blocks" technique, each
case consists of four code snippets, and contains at least one original block and
three copied source code blocks. These copied source code blocks vary in both
size and distribution patterns. According to the evaluation results, 90% of these
plagiarism cases can be detected by CodEX and are assigned high global
similarities (in excess of the similarity threshold), and the only one plagiarism case
that was not detected as the plagiarism case is found to contain small scattered
copied code blocks.</p>
      <p>Apart from test cases about one single plagiarism technique, the 10 mixed
test cases applying all the plagiarism techniques are also designed to test the
overall plagiarism detection accuracy of CodEX. 80% of these mixed-plagiarism
source les are judged as plagiarism cases by the system and 20% of them are
not detected as plagiarism cases as their copied code blocks are scattered and
relatively small.</p>
      <p>In summary, CodEX achieves accuracy of 84% for the source code snippet
search, and achieves high performance on detecting all the ve plagiarism
techniques introduced before as well as the mixed plagiarism cases based on them,
with a 95% success rate overall.
5</p>
    </sec>
    <sec id="sec-5">
      <title>Conclusion</title>
      <p>As a source code search engine, CodEX supports code snippet search and source
code plagiarism detection, distinguishing itself from most traditional code search
engines. As is demonstrated by the evaluation results, ve commonly-used
plagiarism techniques can be detected accurately. Additionally, a partial solution
to the \meaningless code insertion" issue is proposed. Therefore, CodEX brings
convenience to both programmers and education sta , and its high accuracy
proves the feasibility of several innovated code searching algorithms. For the
future work, all the thresholds should be tuned further with larger quantities of
test cases to achieve higher performance. Additionally, removing unused
variables and code was not implemented in this version due to speed constraints; an
e cient mechanism for this can be added in future. Finally, CodEX should be
extended for more programming languages other than Java and Python.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Al-Khanjari</surname>
            ,
            <given-names>Z.A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fiaidhi</surname>
            ,
            <given-names>J.A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Al-Hinai</surname>
            ,
            <given-names>R.A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kutti</surname>
            ,
            <given-names>N.S.:</given-names>
          </string-name>
          <article-title>Plagdetect: A java programming plagiarism detection tool</article-title>
          .
          <source>ACM Inroads</source>
          <volume>1</volume>
          (
          <issue>4</issue>
          ),
          <volume>66</volume>
          {71 (Dec
          <year>2010</year>
          ), http://doi.acm.
          <source>org.ucd.idm.oclc.org/10</source>
          .1145/1869746.1869766
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Bajracharya</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ngo</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Linstead</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dou</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rigor</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Baldi</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lopes</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>Sourcerer: a search engine for open source code supporting structure-based search</article-title>
          . vol.
          <year>2006</year>
          , pp.
          <volume>681</volume>
          {
          <fpage>682</fpage>
          .
          <string-name>
            <surname>ACM</surname>
          </string-name>
          (
          <year>2006</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Bukh</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ma</surname>
          </string-name>
          , J.:
          <article-title>Longest common subsequences in sets of words</article-title>
          .
          <source>SIAM Journal on Discrete Mathematics</source>
          <volume>28</volume>
          (
          <issue>4</issue>
          ),
          <year>2042</year>
          {
          <year>2049</year>
          (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Chilowicz</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          , Duris, ., Roussel, G.:
          <article-title>Viewing functions as token sequences to highlight similarities in source code</article-title>
          .
          <source>Science of Computer Programming</source>
          <volume>78</volume>
          (
          <issue>10</issue>
          ),
          <year>1871</year>
          {
          <year>1891</year>
          (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Clough</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          :
          <article-title>Plagiarism in natural and programming languages: an overview of current tools and technologies (</article-title>
          <year>2000</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Gitchell</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tran</surname>
          </string-name>
          , N.:
          <article-title>Sim: A utility for detecting similarity in computer programs</article-title>
          .
          <source>SIGCSE Bull</source>
          .
          <volume>31</volume>
          (
          <issue>1</issue>
          ),
          <volume>266</volume>
          {270 (Mar
          <year>1999</year>
          ), http://doi.acm.
          <source>org.ucd.idm.oclc. org/10</source>
          .1145/384266.299783
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Greenan</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          :
          <article-title>Method-level code clone detection on transformed abstract syntax trees using sequence matching algorithms</article-title>
          .
          <source>Student Report</source>
          , University of California-Santa
          <string-name>
            <surname>Cruz</surname>
          </string-name>
          ,
          <string-name>
            <surname>Winter</surname>
          </string-name>
          (
          <year>2005</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Korf</surname>
          </string-name>
          , R.E.:
          <article-title>Depth- rst iterative-deepening: An optimal admissible tree search</article-title>
          .
          <source>Arti cial intelligence</source>
          <volume>27</volume>
          (
          <issue>1</issue>
          ),
          <volume>97</volume>
          {
          <fpage>109</fpage>
          (
          <year>1985</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Li</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wang</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Li</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Cai</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          :
          <article-title>Detecting source code changes to maintain the consistence of behavioral model</article-title>
          . pp.
          <volume>1</volume>
          {
          <issue>6</issue>
          .
          <string-name>
            <surname>ACM</surname>
          </string-name>
          (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Neamtiu</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Foster</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hicks</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Understanding source code evolution using abstract syntax tree matching</article-title>
          .
          <source>ACM SIGSOFT Software Engineering Notes</source>
          <volume>30</volume>
          (
          <issue>4</issue>
          ), 1{
          <issue>5</issue>
          (
          <year>2005</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Nilsson</surname>
          </string-name>
          , E.:
          <article-title>Abstract syntax tree analysis for plagiarism detection (</article-title>
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Schleimer</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wilkerson</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Aiken</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Winnowing: local algorithms for document ngerprinting</article-title>
          . pp.
          <volume>76</volume>
          {
          <fpage>85</fpage>
          .
          <string-name>
            <surname>ACM</surname>
          </string-name>
          (
          <year>2003</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Verco</surname>
            ,
            <given-names>K.L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wise</surname>
            ,
            <given-names>M.J.</given-names>
          </string-name>
          :
          <article-title>Software for detecting suspected plagiarism: Comparing structure and attribute-counting systems</article-title>
          .
          <source>ACSE 96</source>
          (
          <year>1996</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Whale</surname>
          </string-name>
          , G.:
          <article-title>Plague: plagiarism detection using program structure. School of Electrical Engineering</article-title>
          and Computer Science, University of New South Wales (
          <year>1988</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <surname>Wile</surname>
            ,
            <given-names>D.S.:</given-names>
          </string-name>
          <article-title>Abstract syntax from concrete syntax</article-title>
          .
          <source>In: Proceedings of the 19th international conference on Software engineering</source>
          . pp.
          <volume>472</volume>
          {
          <fpage>480</fpage>
          .
          <string-name>
            <surname>ACM</surname>
          </string-name>
          (
          <year>1997</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>