Compare commits
6 Commits
4.436.0-RE
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fdd2b954fe | ||
|
|
2d3a048487 | ||
|
|
518c38c2e9 | ||
|
|
21097a6419 | ||
|
|
c8dd167606 | ||
|
|
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);
|
||||
}
|
||||
|
||||
@ -152,7 +152,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());
|
||||
|
||||
@ -25,7 +25,8 @@ fforesight:
|
||||
ignored-endpoints: [ '/redaction-gateway-v1', '/actuator/health/**',"/api/rules-logging/rulesocket","/api/rules-logging/rulesocket/**", '/redaction-gateway-v1/async/download/with-ott/**',
|
||||
'/internal-api/**', '/redaction-gateway-v1/docs/swagger-ui', '/rules/test',
|
||||
'/redaction-gateway-v1/docs/**','/redaction-gateway-v1/docs',
|
||||
'/api', '/api/','/api/docs/**','/api/docs','/api/docs/swagger-ui' ]
|
||||
'/api', '/api/','/api/docs/**','/api/docs','/api/docs/swagger-ui',
|
||||
'/actuator/prometheus' ]
|
||||
|
||||
spring:
|
||||
application:
|
||||
|
||||
@ -1584,6 +1584,23 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
|
||||
end
|
||||
|
||||
|
||||
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
|
||||
salience 256
|
||||
when
|
||||
$intersection: Containment(
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
!$container.removed(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() == $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.7
|
||||
rule "X.7.0: Remove all images"
|
||||
salience 512
|
||||
|
||||
@ -261,7 +261,6 @@ public class DocumineFloraTest extends AbstractRedactionIntegrationTest {
|
||||
}
|
||||
|
||||
|
||||
@Disabled
|
||||
@Test
|
||||
public void testDoseMortalityExtraction() {
|
||||
|
||||
|
||||
@ -1315,6 +1315,7 @@ rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.3
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
@ -1384,6 +1385,23 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
|
||||
end
|
||||
|
||||
|
||||
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
|
||||
salience 256
|
||||
when
|
||||
$intersection: Containment(
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
!$container.removed(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() == $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
|
||||
@ -2079,6 +2079,7 @@ rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.3
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
@ -2148,6 +2149,23 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
|
||||
end
|
||||
|
||||
|
||||
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
|
||||
salience 256
|
||||
when
|
||||
$intersection: Containment(
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
!$container.removed(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() == $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
|
||||
@ -1451,6 +1451,7 @@ rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.3
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
@ -1520,6 +1521,23 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
|
||||
end
|
||||
|
||||
|
||||
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
|
||||
salience 256
|
||||
when
|
||||
$intersection: Containment(
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
!$container.removed(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() == $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.7
|
||||
rule "X.7.0: Remove all images"
|
||||
salience 512
|
||||
|
||||
@ -1042,6 +1042,7 @@ rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.3
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
@ -1111,6 +1112,23 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
|
||||
end
|
||||
|
||||
|
||||
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
|
||||
salience 256
|
||||
when
|
||||
$intersection: Containment(
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
!$container.removed(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() == $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
|
||||
@ -363,6 +363,7 @@ rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.3
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
@ -432,6 +433,23 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
|
||||
end
|
||||
|
||||
|
||||
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
|
||||
salience 256
|
||||
when
|
||||
$intersection: Containment(
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
!$container.removed(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() == $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
|
||||
@ -1408,6 +1408,23 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
|
||||
end
|
||||
|
||||
|
||||
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
|
||||
salience 256
|
||||
when
|
||||
$intersection: Containment(
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
!$container.removed(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() == $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
|
||||
@ -423,6 +423,7 @@ rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.3
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
@ -492,6 +493,23 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
|
||||
end
|
||||
|
||||
|
||||
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
|
||||
salience 256
|
||||
when
|
||||
$intersection: Containment(
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
!$container.removed(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() == $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
|
||||
@ -513,6 +513,7 @@ rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.3
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
@ -582,6 +583,23 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
|
||||
end
|
||||
|
||||
|
||||
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
|
||||
salience 256
|
||||
when
|
||||
$intersection: Containment(
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
!$container.removed(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() == $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
|
||||
@ -396,38 +396,6 @@ rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE"
|
||||
$contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.ENTITY,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.HINT,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$contained.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
salience 64
|
||||
when
|
||||
@ -445,6 +413,7 @@ rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.3
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
@ -514,6 +483,23 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
|
||||
end
|
||||
|
||||
|
||||
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
|
||||
salience 256
|
||||
when
|
||||
$intersection: Containment(
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
!$container.removed(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() == $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
|
||||
@ -995,6 +995,23 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
|
||||
end
|
||||
|
||||
|
||||
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
|
||||
salience 256
|
||||
when
|
||||
$intersection: Containment(
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
!$container.removed(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() == $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
|
||||
@ -2187,6 +2187,23 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
|
||||
end
|
||||
|
||||
|
||||
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
|
||||
salience 256
|
||||
when
|
||||
$intersection: Containment(
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
!$container.removed(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() == $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
|
||||
@ -1589,6 +1589,23 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
|
||||
end
|
||||
|
||||
|
||||
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
|
||||
salience 256
|
||||
when
|
||||
$intersection: Containment(
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
!$container.removed(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() == $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.7
|
||||
rule "X.7.0: Remove all images"
|
||||
salience 512
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user