RED-10633: Duplicated values when extracting from table in DM 1.3.0
This commit is contained in:
parent
22b2a6474b
commit
9bd5577986
@ -47,7 +47,7 @@ public class TextEntity implements IEntity {
|
||||
|
||||
TextRange textRange;
|
||||
@Builder.Default
|
||||
List<TextRange> duplicateTextRanges = new ArrayList<>();
|
||||
Set<TextRange> duplicateTextRanges = new HashSet<>();
|
||||
String type; // TODO: make final once ManualChangesApplicationService::recategorize is deleted
|
||||
final EntityType entityType;
|
||||
|
||||
@ -215,22 +215,20 @@ public class TextEntity implements IEntity {
|
||||
return textEntity.contains(this);
|
||||
}
|
||||
|
||||
|
||||
public boolean contains(TextEntity textEntity) {
|
||||
|
||||
if (this.textRange.contains(textEntity.getTextRange())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
List<TextRange> textEntityDuplicateRanges = textEntity.getDuplicateTextRanges();
|
||||
// use optimized indexed loops for extra performance boost
|
||||
for (int i = 0, duplicateTextRangesSize = duplicateTextRanges.size(); i < duplicateTextRangesSize; i++) {
|
||||
TextRange duplicateTextRange = duplicateTextRanges.get(i);
|
||||
Set<TextRange> textEntityDuplicateRanges = textEntity.getDuplicateTextRanges();
|
||||
|
||||
for (TextRange duplicateTextRange : this.duplicateTextRanges) {
|
||||
if (duplicateTextRange.contains(textEntity.getTextRange())) {
|
||||
return true;
|
||||
}
|
||||
for (int j = 0, textEntityDuplicateRangesSize = textEntityDuplicateRanges.size(); j < textEntityDuplicateRangesSize; j++) {
|
||||
TextRange otherRange = textEntityDuplicateRanges.get(j);
|
||||
|
||||
for (TextRange otherRange : textEntityDuplicateRanges) {
|
||||
if (duplicateTextRange.contains(otherRange)) {
|
||||
return true;
|
||||
}
|
||||
@ -241,6 +239,7 @@ public class TextEntity implements IEntity {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean intersects(TextEntity textEntity) {
|
||||
|
||||
return this.textRange.intersects(textEntity.getTextRange()) //
|
||||
|
||||
@ -155,7 +155,7 @@ public class ManualChangesApplicationService {
|
||||
entityToBeResized.setTextRange(closestEntity.getTextRange());
|
||||
entityToBeResized.setTextAfter(closestEntity.getTextAfter());
|
||||
entityToBeResized.setTextBefore(closestEntity.getTextBefore());
|
||||
entityToBeResized.setDuplicateTextRanges(new ArrayList<>(closestEntity.getDuplicateTextRanges()));
|
||||
entityToBeResized.setDuplicateTextRanges(new HashSet<>(closestEntity.getDuplicateTextRanges()));
|
||||
entityToBeResized.setValue(closestEntity.getValue());
|
||||
entityToBeResized.setPages(newIntersectingPages);
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ public class EntityFromPrecursorCreationService {
|
||||
}
|
||||
correctEntity.setDeepestFullyContainingNode(closestEntity.getDeepestFullyContainingNode());
|
||||
correctEntity.setIntersectingNodes(new ArrayList<>(closestEntity.getIntersectingNodes()));
|
||||
correctEntity.setDuplicateTextRanges(new ArrayList<>(closestEntity.getDuplicateTextRanges()));
|
||||
correctEntity.setDuplicateTextRanges(new HashSet<>(closestEntity.getDuplicateTextRanges()));
|
||||
correctEntity.setPages(new HashSet<>(closestEntity.getPages()));
|
||||
|
||||
correctEntity.setValue(closestEntity.getValue());
|
||||
|
||||
@ -261,7 +261,6 @@ public class DocumineFloraTest extends AbstractRedactionIntegrationTest {
|
||||
}
|
||||
|
||||
|
||||
@Disabled
|
||||
@Test
|
||||
public void testDoseMortalityExtraction() {
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user