Pull request #328: RED-3133: Fixed bug in address combination rule

Merge in RED/redaction-service from RED-3133-4 to master

* commit 'c21cf3dd5cdf70dfb838bb18f78a7c32715f8db8':
  RED-3133: Fixed bug in address combination rule
This commit is contained in:
Dominique Eiflaender 2022-01-26 13:09:13 +01:00
commit 38a386bc87

View File

@ -108,6 +108,12 @@ public class Section {
lastEnd = -1;
numberOfMatchParts = 0;
foundParts = new HashSet<>();
if(entity.getType().equals(startType)){
lastEnd = entity.getEnd();
start = entity.getStart();
foundParts.add(entity.getType());
numberOfMatchParts++;
}
} else if(entity.getType().equals(startType) && start != -1){
if(numberOfMatchParts >= minPartMatches) {
String value = searchText.substring(start, lastEnd);
@ -117,6 +123,8 @@ public class Section {
lastEnd = entity.getEnd();
numberOfMatchParts = 0;
foundParts = new HashSet<>();
foundParts.add(entity.getType());
numberOfMatchParts++;
} else if(start != -1 && combineSet.contains(entity.getType()) && entity.getStart() - lastEnd < maxDistanceBetween){
lastEnd = entity.getEnd();
numberOfMatchParts++;