Try to preserve leading spaces in OCREngine.
This commit is contained in:
parent
c739892e5b
commit
96347646bb
1 changed files with 2 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ from ..glyphdb import GlyphDB
|
||||||
|
|
||||||
|
|
||||||
class OCREngine(QThread):
|
class OCREngine(QThread):
|
||||||
|
SPACE_WIDTH = 15
|
||||||
unknownGlyph = signal([Glyph])
|
unknownGlyph = signal([Glyph])
|
||||||
pageChanged = signal([Page])
|
pageChanged = signal([Page])
|
||||||
|
|
||||||
|
|
@ -62,6 +63,7 @@ class OCREngine(QThread):
|
||||||
yield ''.join(self.recognize_line(line))
|
yield ''.join(self.recognize_line(line))
|
||||||
|
|
||||||
def recognize_line(self, line):
|
def recognize_line(self, line):
|
||||||
|
yield from ' ' * int(line.indent / self.SPACE_WIDTH)
|
||||||
for glyph in line.glyphs:
|
for glyph in line.glyphs:
|
||||||
yield self.recognize_glyph(glyph)
|
yield self.recognize_glyph(glyph)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue