Pull request #440: RED-4799

Merge in RED/redaction-service from RED-4799-33x-release-fix to release/3.107.x

* commit '4289dfee2ddc1acf673ce7d16569ab514d1bbe6e':
  RED-4799
This commit is contained in:
Timo Bejan 2022-07-27 12:00:20 +02:00
commit d616dc9a57

View File

@ -164,6 +164,15 @@ public class EntitySearchUtils {
List<Entity> wordsToRemove = new ArrayList<>();
for (Entity word : entities) {
for (Entity inner : entities) {
// skip cross-type false positives
if(word.getEntityType() == EntityType.FALSE_POSITIVE && inner.getEntityType() == EntityType.ENTITY && !inner.getType().equals(word.getType())){
continue;
}
// skip cross-type false reccommendations
if(word.getEntityType() == EntityType.FALSE_RECOMMENDATION && inner.getEntityType() == EntityType.RECOMMENDATION && !inner.getType().equals(word.getType())){
continue;
}
if (inner.getWord().length() < word.getWord()
.length() && inner.getStart() >= word.getStart() && inner.getEnd() <= word.getEnd() && word != inner && word.getSectionNumber() == inner.getSectionNumber()) {
if (word.getEntityType().equals(EntityType.RECOMMENDATION) && inner.getEntityType().equals(EntityType.ENTITY)) {