RED-5139: Bugfix if false positives are added, for rule added entries
This commit is contained in:
parent
4e96718ce3
commit
0c95bf3bbc
@ -1005,12 +1005,6 @@ public class Section {
|
||||
private Set<Entity> findEntities(String value, String asType, boolean caseInsensitive, boolean redacted,
|
||||
int ruleNumber, String reason, String legalBasis, Engine engine,
|
||||
boolean asRecommendation) {
|
||||
return findEntities(value, asType, caseInsensitive, redacted, true, ruleNumber, reason, legalBasis, engine, asRecommendation);
|
||||
}
|
||||
|
||||
private Set<Entity> findEntities(String value, String asType, boolean caseInsensitive, boolean redacted, boolean excludeFalsePositives,
|
||||
int ruleNumber, String reason, String legalBasis, Engine engine,
|
||||
boolean asRecommendation) {
|
||||
|
||||
String text = caseInsensitive ? searchText.toLowerCase() : searchText;
|
||||
Set<Entity> found = EntitySearchUtils.findEntities(text, new SearchImplementation(value, caseInsensitive), dictionary.getType(asType), new FindEntityDetails(asType, headline, sectionNumber, false, false, engine, asRecommendation ? EntityType.RECOMMENDATION : EntityType.ENTITY));
|
||||
@ -1025,11 +1019,8 @@ public class Section {
|
||||
|
||||
var cleared = EntitySearchUtils.clearAndFindPositions(found, searchableText, dictionary, manualRedactions);
|
||||
|
||||
if (excludeFalsePositives) {
|
||||
return cleared.stream().filter(f -> !f.isFalsePositive()).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
return cleared;
|
||||
}
|
||||
|
||||
|
||||
@ -1070,7 +1061,7 @@ public class Section {
|
||||
} else {
|
||||
String word = value.toString();
|
||||
|
||||
Set<Entity> found = findEntities(word.trim(), type, false, redact, false, ruleNumber, reason, legalBasis, Engine.RULE, false);
|
||||
Set<Entity> found = findEntities(word.trim(), type, false, redact, ruleNumber, reason, legalBasis, Engine.RULE, false);
|
||||
|
||||
for (Entity entity: found) {// Should be found
|
||||
entity.setTargetSequences(value.getTextBlocks()
|
||||
@ -1079,10 +1070,6 @@ public class Section {
|
||||
.flatMap(Collection::stream)
|
||||
.collect(Collectors.toList())); // Make sure no other cells with same content are highlighted
|
||||
|
||||
if (entity.isFalsePositive()) {
|
||||
entity.setFalsePositive(true);
|
||||
entity.setRedaction(false);
|
||||
}
|
||||
}
|
||||
|
||||
EntitySearchUtils.clearAndFindPositions(found, searchableText, dictionary, manualRedactions);
|
||||
|
||||
@ -254,9 +254,6 @@ public class EntitySearchUtils {
|
||||
existing.setRedactionReason(found.getRedactionReason());
|
||||
existing.setFalsePositive(found.isFalsePositive());
|
||||
|
||||
if (found.isFalsePositive()) {
|
||||
existing.setRedaction(false);
|
||||
}
|
||||
if (existing.getEntityType().equals(EntityType.RECOMMENDATION) && found.getEntityType().equals(EntityType.ENTITY)
|
||||
|| existing.getEntityType().equals(EntityType.ENTITY) && found.getEntityType().equals(EntityType.RECOMMENDATION)) {
|
||||
existing.setEntityType(EntityType.ENTITY);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user