From 69d7616c017df68c71508909487fec501d8fc8aa Mon Sep 17 00:00:00 2001 From: Luca Foppiano Date: Thu, 26 Dec 2024 12:45:54 +0100 Subject: [PATCH] cosmetics --- .../java/org/grobid/core/document/BasicStructureBuilder.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grobid-core/src/main/java/org/grobid/core/document/BasicStructureBuilder.java b/grobid-core/src/main/java/org/grobid/core/document/BasicStructureBuilder.java index a9dcec56d1..2b90169249 100755 --- a/grobid-core/src/main/java/org/grobid/core/document/BasicStructureBuilder.java +++ b/grobid-core/src/main/java/org/grobid/core/document/BasicStructureBuilder.java @@ -4,6 +4,7 @@ import com.google.common.collect.SortedSetMultimap; import com.google.common.collect.TreeMultimap; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.grobid.core.data.BibDataSet; @@ -163,7 +164,7 @@ static public Document generalResultSegmentation(Document doc, String labeledRes Block block = docBlocks.get(blockIndex); List tokens = block.getTokens(); String localText = block.getText(); - if ( (tokens == null) || (localText == null) || (localText.trim().length() == 0) ) { + if ( (tokens == null) || StringUtils.isBlank(localText) ) { blockIndex++; indexLine = 0; if (blockIndex < docBlocks.size()) { @@ -274,7 +275,7 @@ static public Document generalResultSegmentation(Document doc, String labeledRes if (blockIndex == docBlocks.size()) { // the last labelled piece has still to be added - if ((!curPlainLabel.equals(lastPlainLabel)) && (lastPlainLabel != null)) { + if (!StringUtils.equals(curPlainLabel, lastPlainLabel) && lastPlainLabel != null) { if ( (pointerA.getTokenDocPos() <= lastPointer.getTokenDocPos()) && (pointerA.getTokenDocPos() != -1) ) { labeledBlocks.put(lastPlainLabel, new DocumentPiece(pointerA, lastPointer));