-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
The existing setup employs a static originality threshold of 0.51. However, this threshold is tailored for codes, such as Java or Markdown, and might not be suitable for other programming languages. Additionally, it doesn't offer flexibility for users who may want a stricter threshold but are willing to endure longer processing times, or those who prefer a more lenient threshold but prioritize faster analysis speeds. Let's enable users to input their preferred originality threshold.
- Loading branch information
1 parent
e8cb72a
commit 79209a3
Showing
10 changed files
with
130 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/reposense/parser/OriginalityThresholdArgumentType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package reposense.parser; | ||
|
||
import net.sourceforge.argparse4j.inf.Argument; | ||
import net.sourceforge.argparse4j.inf.ArgumentParser; | ||
import net.sourceforge.argparse4j.inf.ArgumentParserException; | ||
import net.sourceforge.argparse4j.inf.ArgumentType; | ||
|
||
/** | ||
* Verifies and parses a string-formatted double, between 0.0 and 1.0, to an {@link Double} object. | ||
*/ | ||
public class OriginalityThresholdArgumentType implements ArgumentType<Double> { | ||
private static final String PARSE_EXCEPTION_MESSAGE_THRESHOLD_OUT_OF_BOUND = | ||
"Invalid threshold. It must be a number between 0.0 and 1.0."; | ||
|
||
@Override | ||
public Double convert(ArgumentParser parser, Argument arg, String value) throws ArgumentParserException { | ||
double threshold = Double.parseDouble(value); | ||
|
||
if (Double.compare(threshold, 0.0) < 0 || Double.compare(threshold, 1.0) > 0) { | ||
throw new ArgumentParserException(PARSE_EXCEPTION_MESSAGE_THRESHOLD_OUT_OF_BOUND, parser); | ||
} | ||
|
||
return threshold; | ||
} | ||
} |
Oops, something went wrong.