Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

ResultIterator returns single Character as Alternatives for Words #119

Closed
Kadrei opened this issue Oct 7, 2015 · 2 comments
Closed

ResultIterator returns single Character as Alternatives for Words #119

Kadrei opened this issue Oct 7, 2015 · 2 comments
Labels

Comments

@Kadrei
Copy link

Kadrei commented Oct 7, 2015

When getting alternatives via Resultiterator.getChoicesAndConfidence() the result is always consisting of just a single character as the alternative String (independent of set level).

mTessBaseAPI.setImage(file);
mTessBaseAPI.getUTF8Text();
ResultIterator it = mTessBaseAPI.getResultIterator()
if(it!=null){
    it.begin();
        do{
             final float confidence = it.confidence(TessBaseAPI.PageIteratorLevel.RIL_WORD);
             final String text = it.getUTF8Text(TessBaseAPI.PageIteratorLevel.RIL_WORD);
             final Rect boundingBox = it.getBoundingRect(TessBaseAPI.PageIteratorLevel.RIL_WORD);
             final List<Pair<String, Double>> alternatives = it.getChoicesAndConfidence(TessBaseAPI.PageIteratorLevel.RIL_WORD);
            } while(it.next(PageIteratorLevel.RIL_WORD)); 
    it.delete();
}

Output (example):

         boundingBox = Rect(281, 479 - 591, 510)
         text = 'BRK-Kreisverband'
         confidence = 86.58778%
         alternatives= [(B,92.23%)(E,81.47%)(8,78.91%)]

Expected would be an alternative String (not only the first characters alternative)

@rmtheis
Copy link
Owner

rmtheis commented Oct 7, 2015

Is level also PageIteratorLevel.RIL_WORD?

@Kadrei
Copy link
Author

Kadrei commented Oct 7, 2015

yes. actually everywhere the final variable level is used. I simply forgot to edit it there. (edited it now)

@rmtheis rmtheis added the bug label Oct 13, 2015
Robyer added a commit to Robyer/tess-two that referenced this issue May 11, 2017
…#119)

ChoicesIterator always return only list of alternatives of symbol, it doesn't let us specify different PageIteratorLevel here. So this commit removes the method parameter and renames the whole method to make more sense.
rmtheis added a commit that referenced this issue Aug 12, 2018
commit f465360
Author: Robert Theis <[email protected]>
Date:   Fri Apr 20 07:24:09 2018 -0700

    Edit change log

commit 6aa9dc7
Author: Robert Theis <[email protected]>
Date:   Fri Apr 20 07:17:42 2018 -0700

    Edit change log

commit ce13d6f
Author: Robert Theis <[email protected]>
Date:   Thu Apr 19 20:56:55 2018 -0700

    Update change log

commit 35d3569
Author: Robert Theis <[email protected]>
Date:   Thu Apr 19 20:13:58 2018 -0700

    Set version to 9.0.0

commit 3b7e544
Author: Robert Theis <[email protected]>
Date:   Thu Apr 19 20:00:01 2018 -0700

    Fix 64-bit issues. Closes #197.

commit 229906e
Author: Robert Theis <[email protected]>
Date:   Thu Apr 19 19:01:38 2018 -0700

    Fix null check

commit 6509ff4
Author: Robert Theis <[email protected]>
Date:   Thu Apr 19 18:38:45 2018 -0700

    Add missing includes

commit 4a4bc77
Author: Robert Theis <[email protected]>
Date:   Thu Apr 19 17:51:19 2018 -0700

    Update dependency versions

commit 0766501
Author: Robert Theis <[email protected]>
Date:   Thu Apr 19 17:41:17 2018 -0700

    Mute libjpeg build warning

commit 5c0b8e3
Author: Robert Theis <[email protected]>
Date:   Thu Apr 19 17:17:49 2018 -0700

    Update documentation

commit e2bea65
Author: Robert Theis <[email protected]>
Date:   Thu Apr 19 16:44:51 2018 -0700

    Catch Arabic/Hindi init misconfigurations. Closes #240.

commit b0f3c2c
Author: Robert Theis <[email protected]>
Date:   Thu Apr 19 13:40:38 2018 -0700

    Edit ABI targets

commit 4661d8e
Author: Robert Theis <[email protected]>
Date:   Thu Apr 19 12:45:51 2018 -0700

    Minor edit to Gradle config

commit 3436f01
Merge: 14fa90a a5fac7d
Author: Robert Theis <[email protected]>
Date:   Wed Jan 17 17:12:42 2018 -0800

    Merge pull request #233 from mauriciotogneri/master

    Updated repositories. Changed compile to implementation.

commit a5fac7d
Author: mtogneri <[email protected]>
Date:   Sat Jan 6 17:57:13 2018 +0100

    Updated repositories. Changed compile to implementation.

commit 14fa90a
Merge: d85ef2d ce84fcd
Author: Robert Theis <[email protected]>
Date:   Thu Dec 28 20:28:25 2017 -0800

    Merge pull request #231 from mauriciotogneri/master

    Updated version of SDK, build tools and support libraries

commit ce84fcd
Author: Mauricio Togneri <[email protected]>
Date:   Fri Dec 15 10:19:15 2017 +0100

    Updated version of SDK, build tools and support libraries

commit d85ef2d
Author: Robert Theis <[email protected]>
Date:   Thu Sep 7 21:46:50 2017 -0700

    Add support annotations

commit 52be81e
Author: Robert Theis <[email protected]>
Date:   Sat Aug 12 20:10:17 2017 -0700

    Update change log

commit d5849be
Author: Robert Theis <[email protected]>
Date:   Sat Aug 12 19:17:18 2017 -0700

    Set version to 8.0.0

commit 688d487
Author: Robert Theis <[email protected]>
Date:   Sat Aug 12 19:17:04 2017 -0700

    Don't build 64-bit ABIs by default

commit ab9b9a3
Author: Robert Theis <[email protected]>
Date:   Sat Jul 22 14:32:20 2017 -0700

    Update readme

commit 5a1e4e2
Author: Robert Theis <[email protected]>
Date:   Wed Jun 28 07:22:16 2017 -0700

    Update Github issue template

commit b57e6af
Merge: 1632130 2dc4ac4
Author: Robert Theis <[email protected]>
Date:   Fri Jun 16 06:37:05 2017 -0700

    Merge pull request #217 from ivankolev/master

    clone tag 3.04.00 from tessdata

commit 2dc4ac4
Author: ivankolev <[email protected]>
Date:   Thu Jun 15 21:06:06 2017 -0400

    clone tag 3.04.00 from tessdata, as master now contains traineddata files for tesseract 4, notably it does not contain eng.cube.* files

commit 1632130
Merge: dafeb3c d727e0c
Author: Robert Theis <[email protected]>
Date:   Wed Jun 14 07:53:18 2017 -0700

    Merge pull request #216 from ivankolev/master

    See issue #215

commit d727e0c
Merge: b4066f1 dafeb3c
Author: ivankolev <[email protected]>
Date:   Tue Jun 13 18:19:09 2017 -0400

    Merge remote-tracking branch 'original-origin/master'

commit dafeb3c
Author: Robert Theis <[email protected]>
Date:   Mon Jun 12 21:25:03 2017 -0700

    Update .gitignore

commit 0bb3eb5
Author: Robert Theis <[email protected]>
Date:   Mon Jun 12 21:23:54 2017 -0700

    Update Gradle plugin

commit a00479b
Author: Robert Theis <[email protected]>
Date:   Mon Jun 12 20:47:15 2017 -0700

    Update change log

commit 686a681
Author: Robert Theis <[email protected]>
Date:   Mon Jun 12 20:09:03 2017 -0700

    Set version to 7.0.0

commit b4066f1
Author: ivankolev <[email protected]>
Date:   Mon Jun 12 18:20:48 2017 -0400

    add header files explicitly so "gradlew assemble" could finish successfully

commit fa9c178
Author: Robert Theis <[email protected]>
Date:   Wed May 17 19:59:07 2017 -0700

    Improve data path used for testing. Closes #208.

commit cc75026
Merge: aa4933b 65a5987
Author: Robert Theis <[email protected]>
Date:   Mon May 15 22:32:02 2017 -0400

    Merge pull request #209 from Robyer/fixPageSegMode

    Add missing PageSegMode constant

commit 65a5987
Author: Robert Pösel <[email protected]>
Date:   Mon May 15 12:59:10 2017 +0200

    Remove PSM_COUNT constant

    It is useless to have this in Java API.

commit 4c75483
Author: Robert Pösel <[email protected]>
Date:   Mon May 15 12:50:57 2017 +0200

    Add missing PSM_RAW_LINE mode

    It was added in Tesseract v3.04

commit aa4933b
Author: Robert Theis <[email protected]>
Date:   Sun May 14 13:19:33 2017 -0700

    Minor update to Javadoc for ResultIterator

commit ba06c7e
Merge: 43c52fe bfe2bcf
Author: Robert Theis <[email protected]>
Date:   Sun May 14 15:52:54 2017 -0400

    Merge pull request #206 from Robyer/improveResultIterator

    Improve ResultIterator

commit 43c52fe
Author: Robert Theis <[email protected]>
Date:   Sun May 14 12:05:54 2017 -0700

    Update test to check BeginDocument return value

commit 615586c
Merge: 98995d4 00d093d
Author: Robert Theis <[email protected]>
Date:   Sun May 14 15:04:33 2017 -0400

    Merge pull request #207 from Robyer/fixBeginDocument

    Fix return value of BeginDocument (fixes #103)

commit 98995d4
Merge: 3bda8b1 939b96e
Author: Robert Theis <[email protected]>
Date:   Sun May 14 14:11:32 2017 -0400

    Merge pull request #205 from Robyer/updateGradlePlugin

    Update gradle plugin

commit 00d093d
Author: Robert Pösel <[email protected]>
Date:   Thu May 11 04:52:56 2017 +0200

    Fix return value of BeginDocument (fixes #103)

    pdfRenderer->BeginDocument return true on success so the condition was wrongly inverted. This commit fixes that and uses a bit cleaner code.

commit bfe2bcf
Author: Robert Pösel <[email protected]>
Date:   Thu May 11 03:59:49 2017 +0200

    Fix typo in nativeDelete method

commit 56203ad
Author: Robert Pösel <[email protected]>
Date:   Thu May 11 04:39:52 2017 +0200

    ResultIterator: Add IsAtBeginningOf and IsAtFinalElement methods

commit 506d004
Author: Robert Pösel <[email protected]>
Date:   Thu May 11 03:35:19 2017 +0200

    Fix static native method parameter

commit bdd2fe7
Author: Robert Pösel <[email protected]>
Date:   Thu May 11 03:06:03 2017 +0200

    Fix size of string holding symbol and confidence

    We're printing "%s|%.2f" which could end up in "%s|100.00" so it's "strlen(utfText) + 7".

commit af9fc83
Author: Robert Pösel <[email protected]>
Date:   Thu May 11 03:01:17 2017 +0200

    ResultIterator can't return choices with custom level (closes #119)

    ChoicesIterator always return only list of alternatives of symbol, it doesn't let us specify different PageIteratorLevel here. So this commit removes the method parameter and renames the whole method to make more sense.

commit 939b96e
Author: Robert Pösel <[email protected]>
Date:   Thu May 11 02:51:57 2017 +0200

    Update gradle plugin

commit 3bda8b1
Merge: 3debecf 7792a02
Author: Robert Theis <[email protected]>
Date:   Thu Apr 27 07:12:34 2017 -0700

    Merge pull request #202 from Robyer/fixJavadocs

    Fix javadocs errors and warnings

commit 7792a02
Author: Robert Pösel <[email protected]>
Date:   Thu Apr 27 08:27:01 2017 +0200

    Fix javadocs errors and warnings
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants