Changed implementation of check similarity to verify exact match of name instead of the first char

This commit is contained in:
Sandro La Bruzzo 2023-11-29 11:17:41 +01:00
parent 59111713fa
commit aa239ec673
2 changed files with 8 additions and 5 deletions

View File

@ -222,7 +222,7 @@ public class AuthorMerger {
nl -> pr nl -> pr
.getName() .getName()
.stream() .stream()
.anyMatch(nr -> nr.substring(0, 1).equalsIgnoreCase(nl.substring(0, 1))))) .anyMatch(nr -> nr.equalsIgnoreCase(nl))))
return true; return true;
} }
@ -236,7 +236,6 @@ public class AuthorMerger {
} }
// //
/** /**
* Method to enrich ORCID information in one list of authors based on another list * Method to enrich ORCID information in one list of authors based on another list
* @param baseAuthor the Author List in the OAF Entity * @param baseAuthor the Author List in the OAF Entity

View File

@ -19,15 +19,19 @@ import eu.dnetlib.dhp.schema.oaf.Author;
public class AuthorMergerTest { public class AuthorMergerTest {
@Test @Test
public void testEnrcichAuthor() throws Exception { public void testEnrcichAuthor() throws Exception {
final ObjectMapper mapper = new ObjectMapper(); final ObjectMapper mapper = new ObjectMapper();
BufferedReader pr = new BufferedReader(new InputStreamReader( BufferedReader pr = new BufferedReader(new InputStreamReader(
Objects.requireNonNull(AuthorMergerTest.class.getResourceAsStream("/eu/dnetlib/dhp/oa/merge/authors_publication_sample.json")))); Objects
.requireNonNull(
AuthorMergerTest.class
.getResourceAsStream("/eu/dnetlib/dhp/oa/merge/authors_publication_sample.json"))));
BufferedReader or = new BufferedReader(new InputStreamReader( BufferedReader or = new BufferedReader(new InputStreamReader(
Objects.requireNonNull(AuthorMergerTest.class.getResourceAsStream("/eu/dnetlib/dhp/oa/merge/authors_orcid_sample.json")))); Objects
.requireNonNull(
AuthorMergerTest.class.getResourceAsStream("/eu/dnetlib/dhp/oa/merge/authors_orcid_sample.json"))));
TypeReference<List<Author>> aclass = new TypeReference<List<Author>>() { TypeReference<List<Author>> aclass = new TypeReference<List<Author>>() {
}; };