am 4ba6eec9: Merge "Fix unit tests."
* commit '4ba6eec9fd50af20eb6ed72ca7476c8549fcbb43': Fix unit tests.main
commit
666eae4f69
|
@ -948,16 +948,15 @@ public class BinaryDictionaryTests extends AndroidTestCase {
|
||||||
final HashSet<String> bigramWord1s = bigrams.get(word0);
|
final HashSet<String> bigramWord1s = bigrams.get(word0);
|
||||||
final WordProperty wordProperty = binaryDictionary.getWordProperty(word0);
|
final WordProperty wordProperty = binaryDictionary.getWordProperty(word0);
|
||||||
assertEquals(bigramWord1s.size(), wordProperty.mBigrams.size());
|
assertEquals(bigramWord1s.size(), wordProperty.mBigrams.size());
|
||||||
final int unigramProbability = wordProperty.getProbability();
|
|
||||||
for (int j = 0; j < wordProperty.mBigrams.size(); j++) {
|
for (int j = 0; j < wordProperty.mBigrams.size(); j++) {
|
||||||
final String word1 = wordProperty.mBigrams.get(j).mWord;
|
final String word1 = wordProperty.mBigrams.get(j).mWord;
|
||||||
assertTrue(bigramWord1s.contains(word1));
|
assertTrue(bigramWord1s.contains(word1));
|
||||||
final int bigramProbability = wordProperty.mBigrams.get(j).getProbability();
|
final int bigramProbabilityDelta = bigramProbabilities.get(
|
||||||
final int probability = binaryDictionary.calculateProbability(
|
new Pair<String, String>(word0, word1));
|
||||||
unigramProbability, bigramProbability);
|
final int unigramProbability = wordProbabilities.get(word1);
|
||||||
assertEquals((int)bigramProbabilities.get(new Pair<String, String>(word0, word1)),
|
final int bigramProbablity = binaryDictionary.calculateProbability(
|
||||||
probability);
|
unigramProbability, bigramProbabilityDelta);
|
||||||
assertEquals(wordProperty.mBigrams.get(j).getProbability(), probability);
|
assertEquals(wordProperty.mBigrams.get(j).getProbability(), bigramProbablity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1040,16 +1039,16 @@ public class BinaryDictionaryTests extends AndroidTestCase {
|
||||||
assertEquals((int)wordProbabilitiesToCheckLater.get(word0),
|
assertEquals((int)wordProbabilitiesToCheckLater.get(word0),
|
||||||
wordProperty.mProbabilityInfo.mProbability);
|
wordProperty.mProbabilityInfo.mProbability);
|
||||||
wordSet.remove(word0);
|
wordSet.remove(word0);
|
||||||
final int unigramProbability = wordProperty.getProbability();
|
|
||||||
final HashSet<String> bigramWord1s = bigrams.get(word0);
|
final HashSet<String> bigramWord1s = bigrams.get(word0);
|
||||||
for (int j = 0; j < wordProperty.mBigrams.size(); j++) {
|
for (int j = 0; j < wordProperty.mBigrams.size(); j++) {
|
||||||
final String word1 = wordProperty.mBigrams.get(j).mWord;
|
final String word1 = wordProperty.mBigrams.get(j).mWord;
|
||||||
assertTrue(bigramWord1s.contains(word1));
|
assertTrue(bigramWord1s.contains(word1));
|
||||||
final int bigramProbability = wordProperty.mBigrams.get(j).getProbability();
|
final int unigramProbability = wordProbabilitiesToCheckLater.get(word1);
|
||||||
final int probability = binaryDictionary.calculateProbability(
|
|
||||||
unigramProbability, bigramProbability);
|
|
||||||
final Pair<String, String> bigram = new Pair<String, String>(word0, word1);
|
final Pair<String, String> bigram = new Pair<String, String>(word0, word1);
|
||||||
assertEquals((int)bigramProbabilitiesToCheckLater.get(bigram), probability);
|
final int bigramProbabilityDelta = bigramProbabilitiesToCheckLater.get(bigram);
|
||||||
|
final int bigramProbablity = binaryDictionary.calculateProbability(
|
||||||
|
unigramProbability, bigramProbabilityDelta);
|
||||||
|
assertEquals(wordProperty.mBigrams.get(j).getProbability(), bigramProbablity);
|
||||||
bigramSet.remove(bigram);
|
bigramSet.remove(bigram);
|
||||||
}
|
}
|
||||||
token = result.mNextToken;
|
token = result.mNextToken;
|
||||||
|
|
Loading…
Reference in New Issue