RED-2167: added computation of cellstarts for tables with two colums
This commit is contained in:
parent
dd81ac79e4
commit
ff97cba0c8
@ -142,7 +142,11 @@ public class SectionTextBuilderService {
|
|||||||
|
|
||||||
SearchableText entireTableText = new SearchableText();
|
SearchableText entireTableText = new SearchableText();
|
||||||
SectionText sectionText = new SectionText();
|
SectionText sectionText = new SectionText();
|
||||||
|
int start = 0;
|
||||||
|
List<Integer> cellStarts = new ArrayList<>();
|
||||||
for (List<Cell> row : table.getRows()) {
|
for (List<Cell> row : table.getRows()) {
|
||||||
|
|
||||||
|
|
||||||
for (Cell cell : row) {
|
for (Cell cell : row) {
|
||||||
if (CollectionUtils.isEmpty(cell.getTextBlocks())) {
|
if (CollectionUtils.isEmpty(cell.getTextBlocks())) {
|
||||||
continue;
|
continue;
|
||||||
@ -160,8 +164,14 @@ public class SectionTextBuilderService {
|
|||||||
for (TextBlock textBlock : cell.getTextBlocks()) {
|
for (TextBlock textBlock : cell.getTextBlocks()) {
|
||||||
entireTableText.addAll(textBlock.getSequences());
|
entireTableText.addAll(textBlock.getSequences());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
cellStarts.add(start);
|
||||||
|
start = start + cell.toString().trim().length() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
sectionText.setCellStarts(cellStarts);
|
||||||
|
|
||||||
sectionText.setText(entireTableText.toString());
|
sectionText.setText(entireTableText.toString());
|
||||||
sectionText.setHeadline(table.getHeadline());
|
sectionText.setHeadline(table.getHeadline());
|
||||||
|
|||||||
@ -664,7 +664,7 @@ public class RedactionIntegrationTest {
|
|||||||
public void redactionTest() throws IOException {
|
public void redactionTest() throws IOException {
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
ClassPathResource pdfFileResource = new ClassPathResource("files/new/Single Study - Oral (Gavage) Mouse.pdf");
|
ClassPathResource pdfFileResource = new ClassPathResource("files/S11.pdf");
|
||||||
AnalyzeRequest request = prepareStorage(pdfFileResource.getInputStream());
|
AnalyzeRequest request = prepareStorage(pdfFileResource.getInputStream());
|
||||||
request.setExcludedPages(Set.of(1));
|
request.setExcludedPages(Set.of(1));
|
||||||
|
|
||||||
@ -889,7 +889,7 @@ public class RedactionIntegrationTest {
|
|||||||
public void classificationTest() throws IOException {
|
public void classificationTest() throws IOException {
|
||||||
|
|
||||||
System.out.println("classificationTest");
|
System.out.println("classificationTest");
|
||||||
ClassPathResource pdfFileResource = new ClassPathResource("files/new/Single Study - Oral (Gavage) Mouse.pdf");
|
ClassPathResource pdfFileResource = new ClassPathResource("files/S11.pdf");
|
||||||
|
|
||||||
AnalyzeRequest request = prepareStorage(pdfFileResource.getInputStream());
|
AnalyzeRequest request = prepareStorage(pdfFileResource.getInputStream());
|
||||||
|
|
||||||
@ -911,7 +911,7 @@ public class RedactionIntegrationTest {
|
|||||||
public void sectionsTest() throws IOException {
|
public void sectionsTest() throws IOException {
|
||||||
|
|
||||||
System.out.println("sectionsTest");
|
System.out.println("sectionsTest");
|
||||||
ClassPathResource pdfFileResource = new ClassPathResource("files/Fludioxonil/51 " + "Fludioxonil_RAR_02_Volume_2_2018-02-21.pdf");
|
ClassPathResource pdfFileResource = new ClassPathResource("files/S11.pdf");
|
||||||
|
|
||||||
AnalyzeRequest request = prepareStorage(pdfFileResource.getInputStream());
|
AnalyzeRequest request = prepareStorage(pdfFileResource.getInputStream());
|
||||||
|
|
||||||
@ -933,7 +933,7 @@ public class RedactionIntegrationTest {
|
|||||||
public void htmlTablesTest() throws IOException {
|
public void htmlTablesTest() throws IOException {
|
||||||
|
|
||||||
System.out.println("htmlTablesTest");
|
System.out.println("htmlTablesTest");
|
||||||
ClassPathResource pdfFileResource = new ClassPathResource("files/Metolachlor/S-Metolachlor_RAR_02_Volume_2_2018-09-06.pdf");
|
ClassPathResource pdfFileResource = new ClassPathResource("files/S11.pdf");
|
||||||
|
|
||||||
AnalyzeRequest request = prepareStorage(pdfFileResource.getInputStream());
|
AnalyzeRequest request = prepareStorage(pdfFileResource.getInputStream());
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user