RED-3061: Logic for value matcher for initials expansion rule is inverted
This commit is contained in:
parent
6bfa54583f
commit
1b9251b0a2
@ -175,27 +175,27 @@ public class Section {
|
|||||||
|
|
||||||
|
|
||||||
@ThenAction
|
@ThenAction
|
||||||
public void expandByRegEx(@Argument(ArgumentType.TYPE) String type, @Argument(ArgumentType.REGEX) String pattern,
|
public void expandByRegEx(@Argument(ArgumentType.TYPE) String type, @Argument(ArgumentType.REGEX) String suffixPattern,
|
||||||
@Argument(ArgumentType.BOOLEAN) boolean patternCaseInsensitive,
|
@Argument(ArgumentType.BOOLEAN) boolean patternCaseInsensitive,
|
||||||
@Argument(ArgumentType.INTEGER) int group) {
|
@Argument(ArgumentType.INTEGER) int group) {
|
||||||
|
|
||||||
expandByRegEx(type, pattern, patternCaseInsensitive, group, null);
|
expandByRegEx(type, suffixPattern, patternCaseInsensitive, group, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ThenAction
|
@ThenAction
|
||||||
public void expandByRegEx(@Argument(ArgumentType.TYPE) String type, @Argument(ArgumentType.REGEX) String pattern,
|
public void expandByRegEx(@Argument(ArgumentType.TYPE) String type, @Argument(ArgumentType.REGEX) String suffixPattern,
|
||||||
@Argument(ArgumentType.BOOLEAN) boolean patternCaseInsensitive,
|
@Argument(ArgumentType.BOOLEAN) boolean patternCaseInsensitive,
|
||||||
@Argument(ArgumentType.INTEGER) int group,
|
@Argument(ArgumentType.INTEGER) int group,
|
||||||
@Argument(ArgumentType.REGEX) String withoutPattern) {
|
@Argument(ArgumentType.REGEX) String compiledValuePattern) {
|
||||||
|
|
||||||
Pattern compiledWithoutPattern = null;
|
Pattern compiledWithoutPattern = null;
|
||||||
|
|
||||||
if (withoutPattern != null) {
|
if (compiledValuePattern != null) {
|
||||||
compiledWithoutPattern = Patterns.getCompiledPattern(withoutPattern, patternCaseInsensitive);
|
compiledWithoutPattern = Patterns.getCompiledPattern(compiledValuePattern, patternCaseInsensitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pattern compiledPattern = Patterns.getCompiledPattern(pattern, patternCaseInsensitive);
|
Pattern compiledPattern = Patterns.getCompiledPattern(suffixPattern, patternCaseInsensitive);
|
||||||
|
|
||||||
Set<Entity> expanded = new HashSet<>();
|
Set<Entity> expanded = new HashSet<>();
|
||||||
for (Entity entity : entities) {
|
for (Entity entity : entities) {
|
||||||
@ -204,9 +204,9 @@ public class Section {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (withoutPattern != null) {
|
if (compiledValuePattern != null) {
|
||||||
Matcher matcherWithout = compiledWithoutPattern.matcher(entity.getWord());
|
Matcher matcherCompiledValuePattern = compiledWithoutPattern.matcher(entity.getWord());
|
||||||
if (matcherWithout.find()) {
|
if (!matcherCompiledValuePattern.matches()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,8 +19,8 @@ rule "0: Expand CBI Authors with firstname initials"
|
|||||||
when
|
when
|
||||||
Section(matchesType("CBI_author") || matchesType("recommendation_CBI_author"))
|
Section(matchesType("CBI_author") || matchesType("recommendation_CBI_author"))
|
||||||
then
|
then
|
||||||
section.expandByRegEx("CBI_author", "(,? [A-Z]\\.?( ?[A-Z]\\.?)?( ?[A-Z]\\.?)?\\b\\.?)", false, 1, "[\\s]+");
|
section.expandByRegEx("CBI_author", "(,? [A-Z]\\.?( ?[A-Z]\\.?)?( ?[A-Z]\\.?)?\\b\\.?)", false, 1, "[^\\s]+");
|
||||||
section.expandByRegEx("recommendation_CBI_author", "(,? [A-Z]\\.?( ?[A-Z]\\.?)?( ?[A-Z]\\.?)?\\b\\.?)", false, 1, "[\\s]+");
|
section.expandByRegEx("recommendation_CBI_author", "(,? [A-Z]\\.?( ?[A-Z]\\.?)?( ?[A-Z]\\.?)?\\b\\.?)", false, 1, "[^\\s]+");
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user