Line._combine_diacritics(): do not lose freestanding diacritic-like symbols.

This commit is contained in:
Andrey Golovizin 2014-08-25 16:02:26 +02:00
parent 7c6faa6acd
commit 9b8a52e4c0

View file

@ -146,8 +146,6 @@ class Line(PageObject):
bodies = defaultdict(list)
diacritics = defaultdict(list)
for i, glyph in enumerate(glyphs):
if glyph.is_body():
continue
neighbours = neighbourhood(glyphs, i, 5)
possible_bodies = [body for body in neighbours if body.detect_diacritic(glyph)]
if possible_bodies:
@ -204,6 +202,8 @@ class Glyph(PageObject):
Higher score means higher probability. Zero means "absolutely not".
"""
if not self.is_body():
return 0
if glyph.elevation > 0 and glyph.elevation < self.DIACRITIC_MIN_ELEVATION:
return 0
if glyph.top >= self.top and glyph.top < self.bottom: