diff --git a/dhp-workflows/dhp-dedup-openaire/src/main/java/eu/dnetlib/dhp/oa/dedup/AuthorMerger.java b/dhp-workflows/dhp-dedup-openaire/src/main/java/eu/dnetlib/dhp/oa/dedup/AuthorMerger.java index 5e63c4b656..ee5fd51656 100644 --- a/dhp-workflows/dhp-dedup-openaire/src/main/java/eu/dnetlib/dhp/oa/dedup/AuthorMerger.java +++ b/dhp-workflows/dhp-dedup-openaire/src/main/java/eu/dnetlib/dhp/oa/dedup/AuthorMerger.java @@ -82,10 +82,11 @@ public class AuthorMerger { .map(ba -> new Tuple2<>(sim(ba, a._2()), ba)) .max(Comparator.comparing(Tuple2::_1)); - if(simAuthor.isPresent()) { + if (simAuthor.isPresent()) { double th = THRESHOLD; - //increase the threshold if the surname is too short - if (simAuthor.get()._2().getSurname() != null && simAuthor.get()._2().getSurname().length()<=3) + // increase the threshold if the surname is too short + if (simAuthor.get()._2().getSurname() != null + && simAuthor.get()._2().getSurname().length() <= 3) th = 0.99; if (simAuthor.get()._1() > th) { @@ -100,9 +101,10 @@ public class AuthorMerger { } public static String pidToComparableString(StructuredProperty pid) { - return (pid.getQualifier() != null ? - pid.getQualifier().getClassid() != null ? pid.getQualifier().getClassid().toLowerCase() : "" : "") - + (pid.getValue() != null ? pid.getValue().toLowerCase() : ""); + return (pid.getQualifier() != null + ? pid.getQualifier().getClassid() != null ? pid.getQualifier().getClassid().toLowerCase() : "" + : "") + + (pid.getValue() != null ? pid.getValue().toLowerCase() : ""); } public static int countAuthorsPids(List authors) { @@ -123,14 +125,13 @@ public class AuthorMerger { final Person pa = parse(a); final Person pb = parse(b); - //if both are accurate (e.g. they have name and surname) + // if both are accurate (e.g. they have name and surname) if (pa.isAccurate() & pb.isAccurate()) { - return - new JaroWinkler().score(normalize(pa.getSurnameString()), normalize(pb.getSurnameString()))*0.5 - + new JaroWinkler().score(normalize(pa.getNameString()), normalize(pb.getNameString()))*0.5; + return new JaroWinkler().score(normalize(pa.getSurnameString()), normalize(pb.getSurnameString())) * 0.5 + + new JaroWinkler().score(normalize(pa.getNameString()), normalize(pb.getNameString())) * 0.5; } else { - return - new JaroWinkler().score(normalize(pa.getNormalisedFullname()), normalize(pb.getNormalisedFullname())); + return new JaroWinkler() + .score(normalize(pa.getNormalisedFullname()), normalize(pb.getNormalisedFullname())); } } diff --git a/dhp-workflows/dhp-dedup-openaire/src/test/java/eu/dnetlib/dhp/oa/dedup/EntityMergerTest.java b/dhp-workflows/dhp-dedup-openaire/src/test/java/eu/dnetlib/dhp/oa/dedup/EntityMergerTest.java index 55879030be..144d5d49a0 100644 --- a/dhp-workflows/dhp-dedup-openaire/src/test/java/eu/dnetlib/dhp/oa/dedup/EntityMergerTest.java +++ b/dhp-workflows/dhp-dedup-openaire/src/test/java/eu/dnetlib/dhp/oa/dedup/EntityMergerTest.java @@ -96,7 +96,7 @@ public class EntityMergerTest implements Serializable { public void publicationMergerTest2() throws InstantiationException, IllegalAccessException, IOException { Publication pub_merged = DedupRecordFactory - .entityMerger(dedupId, publications2.iterator(), 0, dataInfo, Publication.class); + .entityMerger(dedupId, publications2.iterator(), 0, dataInfo, Publication.class); assertEquals(pub_merged.getAuthor().size(), 27); // insert assertions here