Add space_width config variable.
This commit is contained in:
parent
4275671c03
commit
5b1e84dd7f
2 changed files with 2 additions and 3 deletions
|
|
@ -22,6 +22,7 @@ class Configuration(BaseConfiguration):
|
||||||
|
|
||||||
min_body_height = 10
|
min_body_height = 10
|
||||||
min_word_distance = 15
|
min_word_distance = 15
|
||||||
|
space_width = 15
|
||||||
|
|
||||||
diacritic_box_left = -3
|
diacritic_box_left = -3
|
||||||
diacritic_box_right = +3
|
diacritic_box_right = +3
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,6 @@ from .utils import cached_property
|
||||||
|
|
||||||
|
|
||||||
class Document(object):
|
class Document(object):
|
||||||
SPACE_WIDTH = 15
|
|
||||||
|
|
||||||
def __init__(self, dirname, ui, skip=0, limit=None, output_format='text'):
|
def __init__(self, dirname, ui, skip=0, limit=None, output_format='text'):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.dirname = dirname
|
self.dirname = dirname
|
||||||
|
|
@ -61,7 +59,7 @@ class Document(object):
|
||||||
return ''.join(self.output_format.format(glyph_data_seq))
|
return ''.join(self.output_format.format(glyph_data_seq))
|
||||||
|
|
||||||
def recognize_line(self, line):
|
def recognize_line(self, line):
|
||||||
yield from [SPACE] * int(line.indent / self.SPACE_WIDTH)
|
yield from [SPACE] * int(line.indent / self.config.space_width)
|
||||||
for glyph in line.glyphs:
|
for glyph in line.glyphs:
|
||||||
yield self.recognize_glyph(glyph)
|
yield self.recognize_glyph(glyph)
|
||||||
yield NEWLINE
|
yield NEWLINE
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue