diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java index 8eea626768dce554f62d440fda9dc18b2bb418c8..db8d3077dbf2e022536bf0a4f4d5be286c5d13db 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java @@ -93,8 +93,7 @@ public class BinaryDictionary extends Dictionary { int[] prevWordCodePointArray, boolean useFullEditDistance, char[] outputChars, int[] scores, int[] outputIndices); private native int getBigramsNative(long dict, int[] prevWord, int prevWordLength, - int[] inputCodes, int inputCodesLength, char[] outputChars, int[] scores, - int maxWordLength, int maxBigrams); + int[] inputCodes, int inputCodesLength, char[] outputChars, int[] scores); private static native float calcNormalizedScoreNative( char[] before, int beforeLength, char[] after, int afterLength, int score); private static native int editDistanceNative( @@ -130,7 +129,7 @@ public class BinaryDictionary extends Dictionary { if (TextUtils.isEmpty(prevWord)) return null; int tmpCount = getBigramsNative(mNativeDict, prevWordCodePointArray, prevWordCodePointArray.length, mInputCodes, composerSize, - mOutputChars, mOutputScores, MAX_WORD_LENGTH, MAX_PREDICTIONS); + mOutputChars, mOutputScores); count = Math.min(tmpCount, MAX_PREDICTIONS); } else { final InputPointers ips = composer.getInputPointers(); diff --git a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp index 4b18322d9d3640c7867e0e571f17c380adb87c0e..5e3167bc35ac8f2317b7f59ea3b9a870318cb876 100644 --- a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp +++ b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp @@ -167,7 +167,7 @@ static int latinime_BinaryDictionary_getSuggestions(JNIEnv *env, jobject object, static int latinime_BinaryDictionary_getBigrams(JNIEnv *env, jobject object, jlong dict, jintArray prevWordArray, jint prevWordLength, jintArray inputArray, jint inputArraySize, - jcharArray outputArray, jintArray frequencyArray, jint maxWordLength, jint maxBigrams) { + jcharArray outputArray, jintArray frequencyArray) { Dictionary *dictionary = (Dictionary*)dict; if (!dictionary) return 0; jint *prevWord = env->GetIntArrayElements(prevWordArray, 0); @@ -175,7 +175,7 @@ static int latinime_BinaryDictionary_getBigrams(JNIEnv *env, jobject object, jlo jchar *outputChars = env->GetCharArrayElements(outputArray, 0); int *frequencies = env->GetIntArrayElements(frequencyArray, 0); int count = dictionary->getBigrams(prevWord, prevWordLength, inputCodes, - inputArraySize, (unsigned short*) outputChars, frequencies, maxWordLength, maxBigrams); + inputArraySize, (unsigned short*) outputChars, frequencies); env->ReleaseIntArrayElements(frequencyArray, frequencies, 0); env->ReleaseCharArrayElements(outputArray, outputChars, 0); env->ReleaseIntArrayElements(inputArray, inputCodes, JNI_ABORT); @@ -265,7 +265,7 @@ static JNINativeMethod sMethods[] = { (void*) latinime_BinaryDictionary_getSuggestions}, {"getFrequencyNative", "(J[II)I", (void*)latinime_BinaryDictionary_getFrequency}, {"isValidBigramNative", "(J[I[I)Z", (void*)latinime_BinaryDictionary_isValidBigram}, - {"getBigramsNative", "(J[II[II[C[III)I", (void*)latinime_BinaryDictionary_getBigrams}, + {"getBigramsNative", "(J[II[II[C[I)I", (void*)latinime_BinaryDictionary_getBigrams}, {"calcNormalizedScoreNative", "([CI[CII)F", (void*)latinime_BinaryDictionary_calcNormalizedScore}, {"editDistanceNative", "([CI[CI)I", (void*)latinime_BinaryDictionary_editDistance} diff --git a/native/jni/src/bigram_dictionary.cpp b/native/jni/src/bigram_dictionary.cpp index 0c1aa70cbdf3f0bc88a0efe929c5dcb2b154e510..a9ea71813df4bfde883525906858e9190e18c1a0 100644 --- a/native/jni/src/bigram_dictionary.cpp +++ b/native/jni/src/bigram_dictionary.cpp @@ -99,8 +99,7 @@ bool BigramDictionary::addWordBigram(unsigned short *word, int length, int frequ * reduce their scope to the ones that match the first letter. */ int BigramDictionary::getBigrams(const int32_t *prevWord, int prevWordLength, int *inputCodes, - int codesSize, unsigned short *bigramChars, int *bigramFreq, int maxWordLength, - int maxBigrams) const { + int codesSize, unsigned short *bigramChars, int *bigramFreq) const { // TODO: remove unused arguments, and refrain from storing stuff in members of this class // TODO: have "in" arguments before "out" ones, and make out args explicit in the name diff --git a/native/jni/src/bigram_dictionary.h b/native/jni/src/bigram_dictionary.h index 3f397af4d12b0659061ce7b6c00fa004f2ddd863..fa602a18a04551ee6e12b8e77d6a084385c6be1a 100644 --- a/native/jni/src/bigram_dictionary.h +++ b/native/jni/src/bigram_dictionary.h @@ -29,7 +29,7 @@ class BigramDictionary { public: BigramDictionary(const unsigned char *dict, int maxWordLength, int maxPredictions); int getBigrams(const int32_t *word, int length, int *inputCodes, int codesSize, - unsigned short *outWords, int *frequencies, int maxWordLength, int maxBigrams) const; + unsigned short *outWords, int *frequencies) const; int getBigramListPositionForWord(const int32_t *prevWord, const int prevWordLength, const bool forceLowerCaseSearch) const; void fillBigramAddressToFrequencyMapAndFilter(const int32_t *prevWord, const int prevWordLength, diff --git a/native/jni/src/dictionary.h b/native/jni/src/dictionary.h index 6742b48cf696ea9a8e366cbe22b34c6d3244868e..eb6cc96816f08154a6ce0f28202682dd8dec5b2c 100644 --- a/native/jni/src/dictionary.h +++ b/native/jni/src/dictionary.h @@ -59,9 +59,8 @@ class Dictionary { } int getBigrams(const int32_t *word, int length, int *codes, int codesSize, - unsigned short *outWords, int *frequencies, int maxWordLength, int maxBigrams) const { - return mBigramDictionary->getBigrams(word, length, codes, codesSize, outWords, frequencies, - maxWordLength, maxBigrams); + unsigned short *outWords, int *frequencies) const { + return mBigramDictionary->getBigrams(word, length, codes, codesSize, outWords, frequencies); } int getFrequency(const int32_t *word, int length) const;