Class ResultIterator

    • Constructor Detail

    • Method Detail

      • Begin

        public void Begin()
        Moves the iterator to point to the start of the page to begin an iteration.
        Overrides:
        Begin in class PageIterator
      • Next

        @Cast("bool")
        public boolean Next​(@Cast("tesseract::PageIteratorLevel")
                            int level)
        Moves to the start of the next object at the given level in the page hierarchy in the appropriate reading order and returns false if the end of the page was reached. NOTE that RIL_SYMBOL will skip non-text blocks, but all other PageIteratorLevel level values will visit each non-text block once. Think of non text blocks as containing a single para, with a single line, with a single imaginary word. Calls to Next with different levels may be freely intermixed. This function iterates words in right-to-left scripts correctly, if the appropriate language has been loaded into Tesseract.
        Overrides:
        Next in class PageIterator
      • IsAtBeginningOf

        @Cast("bool")
        public boolean IsAtBeginningOf​(@Cast("tesseract::PageIteratorLevel")
                                       int level)
        IsAtBeginningOf() returns whether we're at the logical beginning of the given level. (as opposed to ResultIterator's left-to-right top-to-bottom order). Otherwise, this acts the same as PageIterator::IsAtBeginningOf(). For a full description, see pageiterator.h
        Overrides:
        IsAtBeginningOf in class PageIterator
      • IsAtFinalElement

        @Cast("bool")
        public boolean IsAtFinalElement​(@Cast("tesseract::PageIteratorLevel")
                                        int level,
                                        @Cast("tesseract::PageIteratorLevel")
                                        int element)
        Implement PageIterator's IsAtFinalElement correctly in a BiDi context. For instance, IsAtFinalElement(RIL_PARA, RIL_WORD) returns whether we point at the last word in a paragraph. See PageIterator for full comment.
        Overrides:
        IsAtFinalElement in class PageIterator
      • GetUTF8Text

        @Cast("char*")
        public BytePointer GetUTF8Text​(@Cast("tesseract::PageIteratorLevel")
                                       int level)
        Returns the null terminated UTF-8 encoded text string for the current object at the given level. Use delete [] to free after use.
        Overrides:
        GetUTF8Text in class LTRResultIterator
      • ParagraphIsLtr

        @Cast("bool")
        public boolean ParagraphIsLtr()
        Return whether the current paragraph's dominant reading direction is left-to-right (as opposed to right-to-left).
      • CalculateTextlineOrder

        public static void CalculateTextlineOrder​(@Cast("bool")
                                                  boolean paragraph_is_ltr,
                                                  @Cast("tesseract::StrongScriptDirection*") @StdVector
                                                  IntPointer word_dirs,
                                                  @StdVector
                                                  IntPointer reading_order)
        Yields the reading order as a sequence of indices and (optional) meta-marks for a set of words (given left-to-right). The meta marks are passed as negative values: kMinorRunStart Start of minor direction text. kMinorRunEnd End of minor direction text. kComplexWord The next indexed word contains both left-to-right and right-to-left characters and was treated as neutral. For example, suppose we have five words in a text line, indexed [0,1,2,3,4] from the leftmost side of the text line. The following are all believable reading_orders: Left-to-Right (in ltr paragraph): { 0, 1, 2, 3, 4 } Left-to-Right (in rtl paragraph): { kMinorRunStart, 0, 1, 2, 3, 4, kMinorRunEnd } Right-to-Left (in rtl paragraph): { 4, 3, 2, 1, 0 } Left-to-Right except for an RTL phrase in words 2, 3 in an ltr paragraph: { 0, 1, kMinorRunStart, 3, 2, kMinorRunEnd, 4 }
      • CalculateTextlineOrder

        public static void CalculateTextlineOrder​(@Cast("bool")
                                                  boolean paragraph_is_ltr,
                                                  @Cast("tesseract::StrongScriptDirection*") @StdVector
                                                  int[] word_dirs,
                                                  @StdVector
                                                  int[] reading_order)