Skip to content

Commit

Permalink
cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
lfoppiano committed Dec 26, 2024
1 parent 4fde054 commit 69d7616
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -163,7 +164,7 @@ static public Document generalResultSegmentation(Document doc, String labeledRes
Block block = docBlocks.get(blockIndex);
List<LayoutToken> 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()) {
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 69d7616

Please sign in to comment.