Skip to content

Commit 5768db6

Browse files
committed
Adjust log messages
1 parent 67353c2 commit 5768db6

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

grobid-core/src/main/java/org/grobid/core/engines/FullTextParser.java

+10-6
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,9 @@ else if (config.getConsolidateCitations() == 2)
316316
.filter(f -> !f.isCompleteForTEI())
317317
.collect(Collectors.toList());
318318

319-
LOGGER.info("Number of figures badly formatted or incomplete we identified: " + badFigures.size());
319+
if (CollectionUtils.isEmpty(badFigures)) {
320+
LOGGER.info("Number of figures badly formatted or incomplete we identified: " + badFigures.size());
321+
}
320322
bodyResults = revertResultsForBadItems(badFigures, bodyResults, !(figures.size() > numberFiguresFulltextModel));
321323

322324
figures = figures.stream()
@@ -338,7 +340,9 @@ else if (config.getConsolidateCitations() == 2)
338340
.filter(t -> !(t.isCompleteForTEI() && t.validateTable()))
339341
.collect(Collectors.toList());
340342

341-
LOGGER.info("Number of tables badly formatted or incomplete we identified: " + badTables.size());
343+
if (CollectionUtils.isEmpty(badFigures)) {
344+
LOGGER.info("Number of tables badly formatted or incomplete we identified: " + badTables.size());
345+
}
342346
bodyResults = revertResultsForBadItems(badTables, bodyResults, !(tables.size() > numberTablesFulltextModel));
343347

344348
tables = tables.stream()
@@ -438,7 +442,7 @@ static String revertResultsForBadItems(List<? extends Figure> badFiguresOrTables
438442
List<Integer> candidateIndexes = findCandidateIndex(layoutTokenItem, labelledResultsAsList,
439443
itemLabel, strict);
440444
if (candidateIndexes.isEmpty()) {
441-
LOGGER.info("Cannot find the candidate index for fixing the tables.");
445+
LOGGER.info("Cannot find the candidate index for fixing the figures/tables. Tokens: " + LayoutTokensUtil.toText(layoutTokenItem));
442446
continue;
443447
}
444448

@@ -470,7 +474,7 @@ static String revertResultsForBadItems(List<? extends Figure> badFiguresOrTables
470474
line.set(line.size() - 1, label.replace(itemLabel, TaggingLabels.PARAGRAPH_LABEL));
471475
}
472476
} else {
473-
LOGGER.warn("Cannot find the result index candidate.");
477+
LOGGER.warn("Cannot find the result index candidate for fixing the figure/table. Tokens: " + LayoutTokensUtil.toText(layoutTokenItem));
474478
}
475479
}
476480

@@ -498,7 +502,7 @@ static String revertDiscardedTokensInMainResults(List<List<LayoutToken>> layoutT
498502
// Find the index of the first layoutToken of the table in the tokenization
499503
List<Integer> candidateIndexes = findCandidateIndex(tokens, labelledResultsAsList, itemLabel, strict);
500504
if (candidateIndexes.isEmpty()) {
501-
LOGGER.info("Cannot find the candidate index for fixing the results.");
505+
LOGGER.info("Cannot find the candidate index for fixing the results. Tokens: " + LayoutTokensUtil.toText(tokens));
502506
continue;
503507
}
504508

@@ -534,7 +538,7 @@ static String revertDiscardedTokensInMainResults(List<List<LayoutToken>> layoutT
534538
line.set(line.size() - 1, label.replace(itemLabel, TaggingLabels.PARAGRAPH_LABEL));
535539
}
536540
} else {
537-
LOGGER.warn("Cannot find the result index candidate.");
541+
LOGGER.warn("Cannot find the result index candidate for fixing the results. Tokens " + LayoutTokensUtil.toText(tokens));
538542
}
539543
}
540544

0 commit comments

Comments
 (0)