Skip to content
Snippets Groups Projects
Commit 5b1037fa authored by Jean Chalard's avatar Jean Chalard
Browse files

Fix a bug in the diff tool

Fix reporting of removed attributes multiple times instead
of just one in some cases. Also, report the frequency of
the removed bigram in the same cases.

Change-Id: I1455fa7553fcebc3005c222bf5aa9afcf1678c31
parent d957ded1
No related branches found
No related tags found
No related merge requests found
...@@ -181,16 +181,21 @@ public class Diff extends Dicttool.Command { ...@@ -181,16 +181,21 @@ public class Diff extends Dicttool.Command {
if (!list1.contains(attribute0)) { if (!list1.contains(attribute0)) {
hasDifferences = true; hasDifferences = true;
// Search for a word with the same string but a different frequency // Search for a word with the same string but a different frequency
boolean foundString = false;
for (final WeightedString attribute1 : list1) { for (final WeightedString attribute1 : list1) {
if (attribute0.mWord.equals(attribute1.mWord)) { if (attribute0.mWord.equals(attribute1.mWord)) {
System.out.println(type + " freq changed: " + word + " " System.out.println(type + " freq changed: " + word + " "
+ attribute0.mWord + " " + attribute0.mFrequency + " -> " + attribute0.mWord + " " + attribute0.mFrequency + " -> "
+ attribute1.mFrequency); + attribute1.mFrequency);
list1.remove(attribute1); list1.remove(attribute1);
foundString = true;
break; break;
} }
}
if (!foundString) {
// We come here if we haven't found any matching string. // We come here if we haven't found any matching string.
System.out.println(type + " removed: " + word + " " + attribute0.mWord); System.out.println(type + " removed: " + word + " " + attribute0.mWord + " "
+ attribute0.mFrequency);
} }
} else { } else {
list1.remove(attribute0); list1.remove(attribute0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment