Pull request #468: RSS-106: Fixed not working redactions over multi pages
Merge in RED/redaction-service from RSS-106 to master * commit 'ee5da81299425452171370ab609a0172858c4787': RSS-106: Fixed not working redactions over multi pages
This commit is contained in:
commit
a71a7818c2
@ -69,9 +69,26 @@ public class EntitySearchUtils {
|
|||||||
List<EntityPositionSequence> positionSequences = text.getSequences(firstEntity.getWord()
|
List<EntityPositionSequence> positionSequences = text.getSequences(firstEntity.getWord()
|
||||||
.trim(), dictionary == null || dictionary.isCaseInsensitiveDictionary(firstEntity.getType()), firstEntity.getTargetSequences());
|
.trim(), dictionary == null || dictionary.isCaseInsensitiveDictionary(firstEntity.getType()), firstEntity.getTargetSequences());
|
||||||
|
|
||||||
|
Map<String, List<EntityPositionSequence>> multipartSequenceParts = new HashMap<>();
|
||||||
|
Iterator<EntityPositionSequence> itty = positionSequences.iterator();
|
||||||
|
while (itty.hasNext()){
|
||||||
|
var positionSequence = itty.next();
|
||||||
|
if(positionSequence.getId().contains("-")){
|
||||||
|
multipartSequenceParts.computeIfAbsent(positionSequence.getId().split("-")[0], (x) -> new ArrayList<>()).add(positionSequence);
|
||||||
|
itty.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i <= orderedEntities.size() - 1; i++) {
|
for (int i = 0; i <= orderedEntities.size() - 1; i++) {
|
||||||
try {
|
try {
|
||||||
orderedEntities.get(i).setPositionSequences(List.of(positionSequences.get(i)));
|
List<EntityPositionSequence> toAdd = new ArrayList<>();
|
||||||
|
var currentSeq = positionSequences.get(i);
|
||||||
|
toAdd.add(currentSeq);
|
||||||
|
if(multipartSequenceParts.containsKey(currentSeq.getId())){
|
||||||
|
toAdd.addAll(multipartSequenceParts.get(currentSeq.getId()));
|
||||||
|
}
|
||||||
|
orderedEntities.get(i).setPositionSequences(toAdd);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("Mismatch between EntityPositionSequence and found Entity!");
|
log.warn("Mismatch between EntityPositionSequence and found Entity!");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user