mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Quit checking bigram order in BinaryDictDecoderEncoderTests.
Change-Id: I1b8eb6ab2ea797d2590495b1f57f9ec9560ea817
This commit is contained in:
parent
97a553ae69
commit
42334bb493
@ -355,25 +355,25 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check bigrams
|
// check bigrams
|
||||||
final HashMap<String, List<String>> expBigrams = new HashMap<String, List<String>>();
|
final HashMap<String, Set<String>> expBigrams = new HashMap<String, Set<String>>();
|
||||||
for (int i = 0; i < expectedBigrams.size(); ++i) {
|
for (int i = 0; i < expectedBigrams.size(); ++i) {
|
||||||
final String word1 = expectedWords.get(expectedBigrams.keyAt(i));
|
final String word1 = expectedWords.get(expectedBigrams.keyAt(i));
|
||||||
for (int w2 : expectedBigrams.valueAt(i)) {
|
for (int w2 : expectedBigrams.valueAt(i)) {
|
||||||
if (expBigrams.get(word1) == null) {
|
if (expBigrams.get(word1) == null) {
|
||||||
expBigrams.put(word1, new ArrayList<String>());
|
expBigrams.put(word1, new HashSet<String>());
|
||||||
}
|
}
|
||||||
expBigrams.get(word1).add(expectedWords.get(w2));
|
expBigrams.get(word1).add(expectedWords.get(w2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final HashMap<String, List<String>> actBigrams = new HashMap<String, List<String>>();
|
final HashMap<String, Set<String>> actBigrams = new HashMap<String, Set<String>>();
|
||||||
for (Entry<Integer, ArrayList<PendingAttribute>> entry : resultBigrams.entrySet()) {
|
for (Entry<Integer, ArrayList<PendingAttribute>> entry : resultBigrams.entrySet()) {
|
||||||
final String word1 = resultWords.get(entry.getKey());
|
final String word1 = resultWords.get(entry.getKey());
|
||||||
final int unigramFreq = resultFrequencies.get(entry.getKey());
|
final int unigramFreq = resultFrequencies.get(entry.getKey());
|
||||||
for (PendingAttribute attr : entry.getValue()) {
|
for (PendingAttribute attr : entry.getValue()) {
|
||||||
final String word2 = resultWords.get(attr.mAddress);
|
final String word2 = resultWords.get(attr.mAddress);
|
||||||
if (actBigrams.get(word1) == null) {
|
if (actBigrams.get(word1) == null) {
|
||||||
actBigrams.put(word1, new ArrayList<String>());
|
actBigrams.put(word1, new HashSet<String>());
|
||||||
}
|
}
|
||||||
actBigrams.get(word1).add(word2);
|
actBigrams.get(word1).add(word2);
|
||||||
|
|
||||||
@ -382,7 +382,6 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
|
|||||||
assertTrue(Math.abs(bigramFreq - BIGRAM_FREQ) < TOLERANCE_OF_BIGRAM_FREQ);
|
assertTrue(Math.abs(bigramFreq - BIGRAM_FREQ) < TOLERANCE_OF_BIGRAM_FREQ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEquals(actBigrams, expBigrams);
|
assertEquals(actBigrams, expBigrams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user