Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
lfoppiano committed Dec 17, 2024
1 parent f5eb758 commit 81a1691
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ static String revertResultsForBadItems(List<? extends Figure> badFiguresOrTables
for (Figure badItem : badFiguresOrTables) {
// Find the index of the first layoutToken of the table in the tokenization
List<LayoutToken> layoutTokenItem = badItem.getLayoutTokens();
List<Integer> candidateIndexes = findCandiateIndex(layoutTokenItem, labelledResultsAsList, itemLabel);
List<Integer> candidateIndexes = findCandidateIndex(layoutTokenItem, labelledResultsAsList, itemLabel);
if (candidateIndexes.isEmpty()) {
LOGGER.info("Cannot find the candidate index for fixing the tables.");
continue;
Expand Down Expand Up @@ -441,7 +441,7 @@ static int consolidateResultCandidateThroughSequence(List<Integer> candidateInde
}

@NotNull
static List<Integer> findCandiateIndex(List<LayoutToken> layoutTokenItem, List<List<String>> labelledResultsAsList, String itemLabel) {
static List<Integer> findCandidateIndex(List<LayoutToken> layoutTokenItem, List<List<String>> labelledResultsAsList, String itemLabel) {
LayoutToken firstLayoutTokenItem = layoutTokenItem.get(0);

List<Integer> candidateIndexes = IntStream.range(0, labelledResultsAsList.size())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ package org.grobid.core.engines

import org.apache.commons.lang3.StringUtils
import org.apache.commons.lang3.tuple.Triple
import org.easymock.EasyMock.createMock
import org.grobid.core.analyzers.GrobidAnalyzer
import org.grobid.core.document.Document
import org.grobid.core.document.DocumentSource
import org.grobid.core.engines.label.TaggingLabels.TABLE_LABEL
import org.grobid.core.factory.GrobidFactory
import org.grobid.core.main.LibraryLoader
Expand Down Expand Up @@ -234,10 +231,7 @@ class FullTextParserTest {
}

@Test
fun testFindCandidates() {
var mockDocumentSource = createMock<DocumentSource>(DocumentSource::class.java)
var document = Document.createFromText("")

fun testFindCandidates_shouldFindMultipleResults() {
// i need to prepare a sequence where there might be multiple matches,
// and then verify that the sequence is correctly used for discrimination
var sequence = "This article solves the problem where some of our interaction are fauly. " +
Expand Down Expand Up @@ -284,7 +278,7 @@ class FullTextParserTest {
println(wapitiResult)

val table1Tokens = tokens.subList(25, 61)
val foundCandidateIndex = FullTextParser.findCandiateIndex(table1Tokens, labelledResultsAsList, TABLE_LABEL)
val foundCandidateIndex = FullTextParser.findCandidateIndex(table1Tokens, labelledResultsAsList, TABLE_LABEL)

assertThat(foundCandidateIndex, hasSize(3))
assertThat(foundCandidateIndex.get(0), `is`(13))
Expand Down

0 comments on commit 81a1691

Please sign in to comment.