|
|
5 years ago | |
|---|---|---|
| jplag | 5 years ago | |
| jplag.frontend-utils | 6 years ago | |
| jplag.frontend.chars | 7 years ago | |
| jplag.frontend.cpp | 7 years ago | |
| jplag.frontend.csharp-1.2 | 7 years ago | |
| jplag.frontend.java-1.1exp | 7 years ago | |
| jplag.frontend.java-1.2 | 6 years ago | |
| jplag.frontend.java-1.5 | 7 years ago | |
| jplag.frontend.java-1.7 | 7 years ago | |
| jplag.frontend.java-1.9 | 7 years ago | |
| jplag.frontend.python-3 | 7 years ago | |
| jplag.frontend.scheme | 7 years ago | |
| jplag.frontend.text | 7 years ago | |
| jplag.parent | 6 years ago | |
| jplag.utils | 7 years ago | |
| .gitignore | 6 years ago | |
| LICENSE | 11 years ago | |
| README.md | 5 years ago | |
| UMLClassDiagram.png | 5 years ago | |
| pom.xml | 6 years ago |
This fork focuses on the development of a new Java API for JPlag.
Note: Due to the early stage of development, some details documented below might change before the official release of version 3.0.
mvn clean install from the root of the repository to install all submodules. You will find the JARs in the respective target directories.jplag directory run mvn clean generate-sources package assembly:single.You'll find the generated JAR with all dependencies in jplag/target.
usage: jplag [-h]
[-l {java_1_1,java_1_2,java_1_5,java_1_5_dm,java_1_7,java_1_9,python_3,c_cpp,c_sharp,char,text,scheme}]
[-bc BC] [-v {parser,quiet,long,details}] [-d] [-S S] [-p P]
[-x X] [-t T] [-s S] [-r R] rootDir
JPlag - Detecting Software Plagiarism
positional arguments:
rootDir The root-directory that contains all submissions
named arguments:
-h, --help show this help message and exit
-l {java_1_1,java_1_2,java_1_5,java_1_5_dm,java_1_7,java_1_9,python_3,c_cpp,c_sharp,char,text,scheme}
Select the language to parse the submissions
(default: java_1_9)
-bc BC Name of the directory which contains the base
code (common framework)
-v {parser,quiet,long,details}
Verbosity (default: quiet)
-d (Debug) parser. Non-parsable files will be stored
(default: false)
-S S Look in directories <root-dir>/*/<dir> for
programs
-p P comma-separated list of all filename suffixes
that are included
-x X All files named in <file> will be ignored
-t T Tune the sensitivity of the comparison. A smaller
<n> increases the sensitivity
-s S Similarity Threshold: all matches above this
threshold will be saved
-r R Name of directory in which the web pages will be
stored (default: result)
The new API makes it easy to integrate JPlag's plagiarism detection into external Java projects.
JPlagOptions options = new JPlagOptions("/path/to/rootDir", LanguageOption.JAVA_1_9);
options.setBaseCodeSubmissionName("template");
JPlag jplag = new JPlag(options);
JPlagResult result = jplag.run();
List<JPlagComparison> comparisons = result.getComparisons();
// Optional
File outputDir = new File("/path/to/output");
Report report = new Report(outputDir);
report.writeResult(result);
This section explains some fundamental concepts about JPlag that make it easier to understand and use.
This is the directory in which JPlag will scan for submissions.
Submissions contain the source code that JPlag will parse and compare. They have to be direct children of the root directory and can either be single files or directories.
/path/to/root-directory
├── Submission-1.java
├── ...
└── Submission-n.java
JPlag will read submission directories recursively, so they can contain multiple (nested) source code files.
/path/to/root-directory
├── Submission-1
│ ├── Main.java
│ └── util
│ └── Utils.java
├── ...
└── Submission-n
├── Main.java
└── util
└── Utils.java
If you want JPlag to scan only one specific subdirectory of a submission for source code files (e.g. src), you can pass the --subDir option:
With option --subDir=src
/path/to/root-directory
├── Submission-1
│ ├── src
│ │ ├── Main.java # Included
│ │ └── util
│ │ └── Utils.java # Included
│ ├── lib
│ │ └── Library.java # Ignored
│ └── Other.java # Ignored
└── ...
The base code is a special kind of submission. It is the template that all other submissions are based on. JPlag will ignore any match between two submissions that is also part of the base code.
Like any other submission, the base code has to be a single file or directory in the root directory.
/path/to/root-directory
├── BaseCode
│ └── Solution.java
├── Submission-1
│ └── Solution.java
├── ...
└── Submission-n
└── Solution.java
In this example, students have to solve a given problem by implementing the run method in the template below. Because they are not supposed to modify the main function, it will be identical for each student.
// BaseCode/Solution.java
public class Solution {
// DO NOT MODIFY
public static void main(String[] args) {
Solution solution = new Solution();
solution.run();
}
public void run() {
// TODO: Implement your solution here.
}
}
To prevent JPlag from detecting similarities in the main function (and other parts of the template), we can instruct JPlag to ignore matches with the given base code by providing the --baseCode=<base-code-name> option.
The <base-code-name> in the example above is BaseCode.
We're happy to incorporate all improvements to JPlag into this code base. Feel free to fork the project and send pull requests.
Adding a new language frontend is quite simple. Have a look at one of the jplag.frontend projects. All you need is a parser for the language (e.g., for ANTLR or for JavaCC) and a few lines of code that sends the tokens (that are generated by the parser) to JPlag.