Class AuthorMatchers
java.lang.Object
eu.openaire.common.author.AuthorMatchers
Helper class providing methods to match authors by their names.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <BA,EA> List <AuthorMatch<BA, EA>> findMatches(List<BA> base_authors, List<EA> enrichment_authors, List<AuthorMatcherStep<BA, EA>> steps) Finds matches between a list of base authors and a list of enriching authors using a sequence of matching steps.static booleanmatchEqualsIgnoreCase(String a1, String a2) Checks whether two author names are equal, ignoring case differences.Checks whether two author names match based on ordered tokens and abbreviations.removeMatches(List<String> base_authors, List<String> enriching_authors, java.util.function.BiFunction<String, String, Boolean> matchingFunc) Removes matching authors from two lists using a custom matching function.
-
Constructor Details
-
AuthorMatchers
public AuthorMatchers()
-
-
Method Details
-
matchEqualsIgnoreCase
-
matchOrderedTokenAndAbbreviations
Checks whether two author names match based on ordered tokens and abbreviations.This method leverages the
OrderedTokenAndAbbreviationsMatcherto compare names by considering token order and abbreviation expansion.- Parameters:
a1- The first author name.a2- The second author name.- Returns:
- An
Optional<Double>with a confidence score (1.0 if a match is found), or empty if no match.
-
removeMatches
public static List<String> removeMatches(List<String> base_authors, List<String> enriching_authors, java.util.function.BiFunction<String, String, Boolean> matchingFunc) Removes matching authors from two lists using a custom matching function.This method iterates through the lists of base authors and enriching authors, applying the given matching function to determine matches. If a match is found, both elements are removed from their respective lists.
- Parameters:
base_authors- The list of base authors.enriching_authors- The list of enriching authors.matchingFunc- A function that determines whether two author names match.- Returns:
- A list containing matched base-enriching authors pairs.
-
findMatches
public static <BA,EA> List<AuthorMatch<BA,EA>> findMatches(List<BA> base_authors, List<EA> enrichment_authors, List<AuthorMatcherStep<BA, EA>> steps) Finds matches between a list of base authors and a list of enriching authors using a sequence of matching steps.Each step in the list of
AuthorMatcherStepobjects applies a specific matching strategy. The result is a list of successful matches.- Type Parameters:
BA- The type representing the base author data.EA- The type representing the enriching author data.- Parameters:
base_authors- The list of base authors.enrichment_authors- The list of enriching authors.steps- The list of matching steps to apply.- Returns:
- A list of
AuthorMatchobjects representing the matches found.
-