Skip to content

Commit

Permalink
Fixed downconversion in parser
Browse files Browse the repository at this point in the history
  • Loading branch information
oskopek committed Jan 31, 2021
1 parent eacf953 commit 4b8f2c2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/net/sf/javaanpr/intelligence/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public String parse(RecognizedPlate recognizedPlate, SyntaxAnalysisMode syntaxAn
for (int x = 0; x < rc.getPatterns().size(); x++) {
if (form.getPosition(j).isAllowed(rc.getPattern(x).getChar())) {
RecognizedPattern rp = rc.getPattern(x);
finalPlate.requiredChanges += (rp.getCost() / 100); // +x for its cost
finalPlate.requiredChanges += (rp.getCost() / 100.0); // +x for its cost
finalPlate.addChar(rp.getChar());
break;
}
Expand All @@ -219,7 +219,7 @@ public String parse(RecognizedPlate recognizedPlate, SyntaxAnalysisMode syntaxAn
return recognizedPlate.getString();
}
// else: find the plate with lowest number of swaps
float minimalChanges = Float.POSITIVE_INFINITY;
double minimalChanges = Double.POSITIVE_INFINITY;
int minimalIndex = 0;
for (int i = 0; i < finalPlates.size(); i++) {
logger.debug("Plate {} : {} with required changes {}.", i, finalPlates.get(i).plate,
Expand All @@ -238,7 +238,7 @@ public String parse(RecognizedPlate recognizedPlate, SyntaxAnalysisMode syntaxAn

private static final class FinalPlate {
private String plate;
private float requiredChanges = 0;
private double requiredChanges = 0;

private FinalPlate() {
plate = "";
Expand Down

0 comments on commit 4b8f2c2

Please sign in to comment.