From 81518a857b02cd03f9c2348166bbfe244606c3fa Mon Sep 17 00:00:00 2001 From: Johannes Zillmann Date: Fri, 24 Mar 2017 08:06:54 +0100 Subject: [PATCH] =?UTF-8?q?[WIP]=20don=E2=80=99t=20make=20paragraph=20bold?= =?UTF-8?q?s=20to=20headline?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/transformations/textitem/DetectHeaders.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/javascript/models/transformations/textitem/DetectHeaders.jsx b/src/javascript/models/transformations/textitem/DetectHeaders.jsx index 3c6fa56..328e77c 100644 --- a/src/javascript/models/transformations/textitem/DetectHeaders.jsx +++ b/src/javascript/models/transformations/textitem/DetectHeaders.jsx @@ -91,16 +91,19 @@ export default class DetectHeaders extends ToTextItemTransformation { if (smallesHeadlineLevel < 6) { const nextHeadlineType = headlineByLevel(smallesHeadlineLevel + 1); parseResult.pages.forEach(page => { + var lastItem; page.items.forEach(textItem => { if (!textItem.type && textItem.height == mostUsedHeight && textItem.font !== mostUsedFont + && (!lastItem || lastItem.y < textItem.y || (lastItem.type && lastItem.type.headline) || (lastItem.y - textItem.y > mostUsedDistance * 2)) && textItem.text === textItem.text.toUpperCase() ) { detectedHeaders++; textItem.annotation = DETECTED_ANNOTATION; textItem.type = nextHeadlineType; } + lastItem = textItem; }); }); }