Revert idRemoval fix, removed duplicate code
This commit is contained in:
parent
f693667fbb
commit
d10c0a7900
@ -7,7 +7,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@ -290,47 +289,13 @@ public class EntityRedactionService {
|
|||||||
String lowercaseInputString = searchableString.toLowerCase();
|
String lowercaseInputString = searchableString.toLowerCase();
|
||||||
for (DictionaryModel model : dictionary.getDictionaryModels()) {
|
for (DictionaryModel model : dictionary.getDictionaryModels()) {
|
||||||
if (model.isCaseInsensitive()) {
|
if (model.isCaseInsensitive()) {
|
||||||
found.addAll(find(lowercaseInputString, model.getValues(local), model.getType(), headline, sectionNumber, local));
|
found.addAll(EntitySearchUtils.find(lowercaseInputString, model.getValues(local), model.getType(), headline, sectionNumber, local));
|
||||||
} else {
|
} else {
|
||||||
found.addAll(find(searchableString, model.getValues(local), model.getType(), headline, sectionNumber, local));
|
found.addAll(EntitySearchUtils.find(searchableString, model.getValues(local), model.getType(), headline, sectionNumber, local));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EntitySearchUtils.clearAndFindPositions(found, searchableText, dictionary);
|
return EntitySearchUtils.clearAndFindPositions(found, searchableText, dictionary);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private Set<Entity> find(String inputString, Set<String> values, String type, String headline, int sectionNumber,
|
|
||||||
boolean local) {
|
|
||||||
|
|
||||||
Set<Entity> found = new HashSet<>();
|
|
||||||
|
|
||||||
for (String value : values) {
|
|
||||||
|
|
||||||
if (value.trim().length() <= 2) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int startIndex;
|
|
||||||
int stopIndex = 0;
|
|
||||||
do {
|
|
||||||
startIndex = inputString.indexOf(value, stopIndex);
|
|
||||||
stopIndex = startIndex + value.length();
|
|
||||||
|
|
||||||
if (startIndex > -1 && (startIndex == 0 || Character.isWhitespace(inputString.charAt(startIndex - 1)) || isSeparator(inputString
|
|
||||||
.charAt(startIndex - 1))) && (stopIndex == inputString.length() || isSeparator(inputString.charAt(stopIndex)))) {
|
|
||||||
found.add(new Entity(inputString.substring(startIndex, stopIndex), type, startIndex, stopIndex, headline, sectionNumber, !local));
|
|
||||||
}
|
|
||||||
} while (startIndex > -1);
|
|
||||||
}
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private boolean isSeparator(char c) {
|
|
||||||
|
|
||||||
return Character.isWhitespace(c) || Pattern.matches("\\p{Punct}", String.valueOf(c)) || c == '\"' || c == '‘' || c == '’';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -125,7 +125,7 @@ public class AnnotationHighlightService {
|
|||||||
if (manualRemoval.getId().equals(entityPositionSequence.getId())) {
|
if (manualRemoval.getId().equals(entityPositionSequence.getId())) {
|
||||||
comments = manualRedactions.getComments().get(manualRemoval.getId());
|
comments = manualRedactions.getComments().get(manualRemoval.getId());
|
||||||
String manualOverrideReason = null;
|
String manualOverrideReason = null;
|
||||||
if (manualRemoval.getStatus().equals(Status.APPROVED) && manualRemoval.isRemoveFromDictionary()) {
|
if (manualRemoval.getStatus().equals(Status.APPROVED)) {
|
||||||
entity.setRedaction(false);
|
entity.setRedaction(false);
|
||||||
redactionLogEntry.setRedacted(false);
|
redactionLogEntry.setRedacted(false);
|
||||||
redactionLogEntry.setStatus(Status.APPROVED);
|
redactionLogEntry.setStatus(Status.APPROVED);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user