am c152d7c1: Fix unit tests that use getNgramProbabilityNative().
* commit 'c152d7c19d4a9e84acaf6fffa4f51c583f191f6f': Fix unit tests that use getNgramProbabilityNative().main
commit
38abb47544
|
@ -275,17 +275,16 @@ static jint latinime_BinaryDictionary_getMaxProbabilityOfExactMatches(
|
||||||
}
|
}
|
||||||
|
|
||||||
static jint latinime_BinaryDictionary_getNgramProbability(JNIEnv *env, jclass clazz,
|
static jint latinime_BinaryDictionary_getNgramProbability(JNIEnv *env, jclass clazz,
|
||||||
jlong dict, jintArray word0, jboolean isBeginningOfSentence, jintArray word1) {
|
jlong dict, jobjectArray prevWordCodePointArrays, jbooleanArray isBeginningOfSentenceArray,
|
||||||
|
jintArray word) {
|
||||||
Dictionary *dictionary = reinterpret_cast<Dictionary *>(dict);
|
Dictionary *dictionary = reinterpret_cast<Dictionary *>(dict);
|
||||||
if (!dictionary) return JNI_FALSE;
|
if (!dictionary) return JNI_FALSE;
|
||||||
const jsize word0Length = env->GetArrayLength(word0);
|
const jsize wordLength = env->GetArrayLength(word);
|
||||||
const jsize word1Length = env->GetArrayLength(word1);
|
int wordCodePoints[wordLength];
|
||||||
int word0CodePoints[word0Length];
|
env->GetIntArrayRegion(word, 0, wordLength, wordCodePoints);
|
||||||
int word1CodePoints[word1Length];
|
const PrevWordsInfo prevWordsInfo = JniDataUtils::constructPrevWordsInfo(env,
|
||||||
env->GetIntArrayRegion(word0, 0, word0Length, word0CodePoints);
|
prevWordCodePointArrays, isBeginningOfSentenceArray);
|
||||||
env->GetIntArrayRegion(word1, 0, word1Length, word1CodePoints);
|
return dictionary->getNgramProbability(&prevWordsInfo, wordCodePoints, wordLength);
|
||||||
const PrevWordsInfo prevWordsInfo(word0CodePoints, word0Length, isBeginningOfSentence);
|
|
||||||
return dictionary->getNgramProbability(&prevWordsInfo, word1CodePoints, word1Length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method to iterate all words in the dictionary for makedict.
|
// Method to iterate all words in the dictionary for makedict.
|
||||||
|
|
Loading…
Reference in New Issue