diff --git a/tess-two-test/src/com/googlecode/tesseract/android/test/TessBaseAPITest.java b/tess-two-test/src/com/googlecode/tesseract/android/test/TessBaseAPITest.java index 24b42526f..63f9ab8fe 100644 --- a/tess-two-test/src/com/googlecode/tesseract/android/test/TessBaseAPITest.java +++ b/tess-two-test/src/com/googlecode/tesseract/android/test/TessBaseAPITest.java @@ -112,7 +112,7 @@ public void testChoiceIterator() { List> choicesAndConfidences; iterator.begin(); do { - choicesAndConfidences = iterator.getChoicesAndConfidence(PageIteratorLevel.RIL_SYMBOL); + choicesAndConfidences = iterator.getSymbolChoicesAndConfidence(); assertNotNull("Invalid result.", choicesAndConfidences); for (Pair choiceAndConfidence : choicesAndConfidences) { diff --git a/tess-two/jni/com_googlecode_tesseract_android/resultiterator.cpp b/tess-two/jni/com_googlecode_tesseract_android/resultiterator.cpp index 7f2424e97..4b71ceb08 100644 --- a/tess-two/jni/com_googlecode_tesseract_android/resultiterator.cpp +++ b/tess-two/jni/com_googlecode_tesseract_android/resultiterator.cpp @@ -48,21 +48,20 @@ jfloat Java_com_googlecode_tesseract_android_ResultIterator_nativeConfidence(JNI return (jfloat) resultIterator->Confidence(enumLevel); } -jobjectArray Java_com_googlecode_tesseract_android_ResultIterator_nativeGetChoices(JNIEnv *env, - jobject thiz, jlong nativeResultIterator, jint level) { +jobjectArray Java_com_googlecode_tesseract_android_ResultIterator_nativeGetSymbolChoices(JNIEnv *env, + jobject thiz, jlong nativeResultIterator) { - // Get the actual result iterator and level (as C objects) - PageIteratorLevel enumLevel = (PageIteratorLevel) level; + // Get the actual result iterator (as C object) ResultIterator *resultIterator = (ResultIterator *) nativeResultIterator; - // Create a choice iterator to determine to the number of alternatives + // Create a choice iterator to determine the number of alternatives tesseract::ChoiceIterator ci(*resultIterator); int numberOfAlternatives = 0; do { numberOfAlternatives++; } while (ci.Next()); - // Create a string array to hold the results + // Create a string array to hold the choices jobjectArray ret = (jobjectArray) env->NewObjectArray(numberOfAlternatives, env->FindClass("java/lang/String"), env->NewStringUTF("")); // Save each result to the output array diff --git a/tess-two/src/com/googlecode/tesseract/android/ResultIterator.java b/tess-two/src/com/googlecode/tesseract/android/ResultIterator.java index d970f01fa..b44d2b002 100644 --- a/tess-two/src/com/googlecode/tesseract/android/ResultIterator.java +++ b/tess-two/src/com/googlecode/tesseract/android/ResultIterator.java @@ -76,12 +76,11 @@ public float confidence(int level) { * The default matching text is blank (""). * The default confidence level is zero (0.0) * - * @param level the page iterator level. See {@link PageIteratorLevel}. - * @return A list of pairs with the UTF string and the confidence + * @return A list of pairs with the UTF symbol and the confidence */ - public List> getChoicesAndConfidence(int level) { + public List> getSymbolChoicesAndConfidence() { // Get the native choices - String[] nativeChoices = nativeGetChoices(mNativeResultIterator, level); + String[] nativeChoices = nativeGetSymbolChoices(mNativeResultIterator); // Create the output list ArrayList> pairedResults = new ArrayList>(); @@ -121,7 +120,7 @@ public void delete() { nativeDelete(mNativeResultIterator); } - private static native String[] nativeGetChoices(long nativeResultIterator, int level); + private static native String[] nativeGetSymbolChoices(long nativeResultIterator); private static native String nativeGetUTF8Text(long nativeResultIterator, int level); private static native float nativeConfidence(long nativeResultIterator, int level);