Disable score-based dicritic detection, use the first matching body.

This commit is contained in:
Andrey Golovizin 2014-08-25 13:41:03 +02:00
parent a7f2c332ca
commit ad3fffd7bc

View file

@ -146,8 +146,9 @@ class Line(PageObject):
if glyph.is_body():
continue
neighbours = neighbourhood(glyphs, i, 5)
body = max(neighbours, key=lambda neighbour: neighbour.detect_diacritic(glyph))
if body.detect_diacritic(glyph):
possible_bodies = [body for body in neighbours if body.detect_diacritic(glyph)]
if possible_bodies:
body = possible_bodies[0]
diacritics[body].append(glyph)
bodies[glyph].append(body)
return bodies, diacritics