Pull request #119: RED-1046: Ignore dictionary rank for words that are explicitly set in the rules

Merge in RED/redaction-service from RED-1046 to master

* commit '8965e7654867ff666c54c841319376c5899e7326':
  RED-1046: Ignore dictionary rank for words that are explicitly set in the rules
This commit is contained in:
Dominique Eiflaender 2021-02-05 15:08:15 +01:00
commit 5ecf21290c
2 changed files with 7 additions and 1 deletions

View File

@ -156,7 +156,7 @@ public class Section {
public void addHintAnnotation(String value, String asType) {
Set<Entity> found = findEntities(value.trim(), asType, true, false, 0, null, null);
EntitySearchUtils.addEntitiesWithHigherRank(entities, found, dictionary);
EntitySearchUtils.addEntitiesIgnoreRank(entities, found);
}

View File

@ -121,4 +121,10 @@ public class EntitySearchUtils {
}
entities.add(found);
}
public void addEntitiesIgnoreRank(Set<Entity> entities, Set<Entity> found){
// HashSet keeps old value but we want the new.
entities.removeAll(found);
entities.addAll(found);
}
}