@Override public double calculateFeatureValue(BxLine refLine, BxDocumentBibReferences refs) { return refs.getZone(refLine).getBounds().getX() + refs.getZone(refLine).getBounds().getWidth() - refLine.getBounds().getX() - refLine.getBounds().getWidth(); }
private void appendLine(Document doc, Element parent, BxLine line, Object... hints) { Element node = doc.createElement("Line"); appendPropertyIfNotNull(doc, node, "LineID", line.getId()); appendBounds(doc, node, "LineCorners", line.getBounds(), hints); appendPropertyIfNotNull(doc, node, "LineNext", line.getNextId()); appendProperty(doc, node, "LineNumChars", ""); for (BxWord word : line.getWords()) { appendWord(doc, node, word, hints); } parent.appendChild(node); }
@Override public double calculateFeatureValue(BxLine line, BxPage page) { if (!line.hasPrev()) { return 1.0; } double avLength = 0; int linesCount = 0; for (BxZone zone : page.getZones()) { for (BxLine l : zone.getLines()) { linesCount++; avLength += l.getBounds().getWidth(); } } if (linesCount == 0 || avLength == 0) { return 0; } avLength /= linesCount; return line.getPrev().getBounds().getWidth() / avLength; }
@Override public double calculateFeatureValue(BxLine object, BxPage context) { return object.getBounds().getX() - context.getX(); }