am bcb439e7: Merge "Add jni method to update entries for a word efficiently."
* commit 'bcb439e702081a54c9a96d3b6bf466e11bd69375': Add jni method to update entries for a word efficiently.main
commit
9186dd3492
|
@ -199,6 +199,9 @@ public final class BinaryDictionary extends Dictionary {
|
|||
int[] word, int probability, int timestamp);
|
||||
private static native boolean removeNgramEntryNative(long dict,
|
||||
int[][] prevWordCodePointArrays, boolean[] isBeginningOfSentenceArray, int[] word);
|
||||
private static native boolean updateCounterNative(long dict,
|
||||
int[][] prevWordCodePointArrays, boolean[] isBeginningOfSentenceArray,
|
||||
int[] word, boolean isValidWord, int count, int timestamp);
|
||||
private static native int addMultipleDictionaryEntriesNative(long dict,
|
||||
LanguageModelParam[] languageModelParams, int startIndex);
|
||||
private static native String getPropertyNative(long dict, String query);
|
||||
|
|
|
@ -427,6 +427,19 @@ static bool latinime_BinaryDictionary_removeNgramEntry(JNIEnv *env, jclass clazz
|
|||
CodePointArrayView(wordCodePoints, codePointCount));
|
||||
}
|
||||
|
||||
static bool latinime_BinaryDictionary_updateCounter(JNIEnv *env, jclass clazz, jlong dict,
|
||||
jobjectArray prevWordCodePointArrays, jbooleanArray isBeginningOfSentenceArray,
|
||||
jintArray word, jboolean isValidWord, jint count, jint timestamp) {
|
||||
Dictionary *dictionary = reinterpret_cast<Dictionary *>(dict);
|
||||
if (!dictionary) {
|
||||
return false;
|
||||
}
|
||||
jsize wordLength = env->GetArrayLength(word);
|
||||
int wordCodePoints[wordLength];
|
||||
env->GetIntArrayRegion(word, 0, wordLength, wordCodePoints);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Returns how many language model params are processed.
|
||||
static int latinime_BinaryDictionary_addMultipleDictionaryEntries(JNIEnv *env, jclass clazz,
|
||||
jlong dict, jobjectArray languageModelParams, jint startIndex) {
|
||||
|
@ -724,6 +737,11 @@ static const JNINativeMethod sMethods[] = {
|
|||
const_cast<char *>("(J[[I[Z[I)Z"),
|
||||
reinterpret_cast<void *>(latinime_BinaryDictionary_removeNgramEntry)
|
||||
},
|
||||
{
|
||||
const_cast<char *>("updateCounterNative"),
|
||||
const_cast<char *>("(J[[I[Z[IZII)Z"),
|
||||
reinterpret_cast<void *>(latinime_BinaryDictionary_updateCounter)
|
||||
},
|
||||
{
|
||||
const_cast<char *>("addMultipleDictionaryEntriesNative"),
|
||||
const_cast<char *>(
|
||||
|
|
Loading…
Reference in New Issue