code similarity

code similarity detection

License

License

GroupId

GroupId

com.zhixiangli
ArtifactId

ArtifactId

codesimilarity
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

code similarity
code similarity detection
Project URL

Project URL

https://github.com/zhixiangli/code-similarity
Source Code Management

Source Code Management

https://github.com/zhixiangli/code-similarity

Download codesimilarity

How to add to project

<!-- https://jarcasting.com/artifacts/com.zhixiangli/codesimilarity/ -->
<dependency>
    <groupId>com.zhixiangli</groupId>
    <artifactId>codesimilarity</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.zhixiangli/codesimilarity/
implementation 'com.zhixiangli:codesimilarity:0.0.1'
// https://jarcasting.com/artifacts/com.zhixiangli/codesimilarity/
implementation ("com.zhixiangli:codesimilarity:0.0.1")
'com.zhixiangli:codesimilarity:jar:0.0.1'
<dependency org="com.zhixiangli" name="codesimilarity" rev="0.0.1">
  <artifact name="codesimilarity" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.zhixiangli', module='codesimilarity', version='0.0.1')
)
libraryDependencies += "com.zhixiangli" % "codesimilarity" % "0.0.1"
[com.zhixiangli/codesimilarity "0.0.1"]

Dependencies

compile (2)

Group / Artifact Type Version
org.apache.commons : commons-lang3 jar 3.5
org.apache.commons : commons-collections4 jar 4.1

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

code-similarity

Code Similarity provides some implementations of similarity detection algorithm, including Longest Common Subsequence & Cosine Distance

It used to work on data structure courses & exam code check.

Environmental Requirements

JDK 1.8+

Instructions

Add Dependency

<dependency>
	<groupId>com.zhixiangli</groupId>
	<artifactId>code-similarity</artifactId>
	<version>0.0.2</version>
</dependency>

Example

String a = "public static void main(String[] args) {System.out.println(1);}";
String b = "public static void main(String[] args) {System.out.println(2);}";

// default algorithm is Longest Common Subsequence.
CodeSimilarity codeSimilarity = new CodeSimilarity();
System.out.println(codeSimilarity.get(a, b));

// change similarity algorithm to Cosine Distance.
CodeSimilarity cosineSimilarity = new CodeSimilarity(new CosineSimilarity());
System.out.println(cosineSimilarity.get(a, b));

Versions

Version
0.0.1