bug fix in the AuthorMatch, implementation of the concat function in the model creation with jpath query
This commit is contained in:
parent
613b32fcf7
commit
cb72ce0a22
File diff suppressed because one or more lines are too long
|
@ -178,6 +178,7 @@
|
||||||
"params": {
|
"params": {
|
||||||
"surname_th": 0.75,
|
"surname_th": 0.75,
|
||||||
"fullname_th": 0.75,
|
"fullname_th": 0.75,
|
||||||
|
"size_th": 20,
|
||||||
"mode": "surname"
|
"mode": "surname"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -215,8 +216,8 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "title",
|
"name": "title",
|
||||||
"type": "String",
|
"type": "StringConcat",
|
||||||
"path": "$.title[?(@.qualifier.classid == 'main title')].value",
|
"path": "$.title[?(@.qualifier.classid == 'main title')].value|||$.title[?(@.qualifier.classid == 'subtitle')].value",
|
||||||
"length": 250,
|
"length": 250,
|
||||||
"size": 5
|
"size": 5
|
||||||
},
|
},
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
||||||
package eu.dnetlib.pace.config;
|
package eu.dnetlib.pace.config;
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
String, Int, List, JSON, URL
|
String, Int, List, JSON, URL, StringConcat
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,11 +77,13 @@ public class AuthorsMatch extends AbstractComparator {
|
||||||
//one person is inaccurate
|
//one person is inaccurate
|
||||||
if (p1.isAccurate() ^ p2.isAccurate()) {
|
if (p1.isAccurate() ^ p2.isAccurate()) {
|
||||||
//prepare data
|
//prepare data
|
||||||
|
//data for the accurate person
|
||||||
String name = normalization(p1.isAccurate()? p1.getNormalisedFirstName() : p2.getNormalisedFirstName());
|
String name = normalization(p1.isAccurate()? p1.getNormalisedFirstName() : p2.getNormalisedFirstName());
|
||||||
String surname = normalization(p1.isAccurate()? p2.getNormalisedSurname() : p2.getNormalisedSurname());
|
String surname = normalization(p1.isAccurate()? p1.getNormalisedSurname() : p2.getNormalisedSurname());
|
||||||
|
|
||||||
|
//data for the inaccurate person
|
||||||
String fullname = normalization(
|
String fullname = normalization(
|
||||||
p1.isAccurate() ? ((p1.getNormalisedFullname().isEmpty()) ? p1.getOriginal() : p1.getNormalisedFullname()) : (p2.getNormalisedFullname().isEmpty() ? p2.getOriginal() : p2.getNormalisedFullname())
|
p1.isAccurate() ? ((p2.getNormalisedFullname().isEmpty()) ? p2.getOriginal() : p2.getNormalisedFullname()) : (p1.getNormalisedFullname().isEmpty() ? p1.getOriginal() : p1.getNormalisedFullname())
|
||||||
);
|
);
|
||||||
|
|
||||||
if (fullname.contains(surname)) {
|
if (fullname.contains(surname)) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import net.minidev.json.JSONArray;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class MapDocumentUtil {
|
public class MapDocumentUtil {
|
||||||
|
|
||||||
|
@ -45,6 +46,17 @@ public class MapDocumentUtil {
|
||||||
.forEach(fi::add);
|
.forEach(fi::add);
|
||||||
stringField.put(fdef.getName(), fi);
|
stringField.put(fdef.getName(), fi);
|
||||||
break;
|
break;
|
||||||
|
case StringConcat:
|
||||||
|
String[] jpaths = fdef.getPath().split("\\|\\|\\|");
|
||||||
|
stringField.put(
|
||||||
|
fdef.getName(),
|
||||||
|
new FieldValueImpl(Type.String,
|
||||||
|
fdef.getName(),
|
||||||
|
truncateValue(Arrays.stream(jpaths).map(jpath -> getJPathString(jpath, json)).collect(Collectors.joining(" ")),
|
||||||
|
fdef.getLength())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
m.setFieldMap(stringField);
|
m.setFieldMap(stringField);
|
||||||
|
|
Loading…
Reference in New Issue