def get_bibrefs_from_bibrecs(bibreclist): ''' Retrieve all bibrefs for all the recids in the list @param bibreclist: list of record IDs @type bibreclist: list of int @return: a list of record->bibrefs @return: list of lists ''' return [[bibrec, dbapi.get_possible_bibrecref([''], bibrec, always_match=True)] for bibrec in bibreclist]
def get_possible_bibrefs_from_pid_bibrec(pid, bibreclist, always_match=False): ''' Returns for each bibrec a list of bibrefs for which the surname matches. @param pid: person id to gather the names strings from @param bibreclist: list of bibrecs on which to search ''' pid = wash_integer_id(pid) pid_names = dbapi.get_person_names_set([pid]) lists = [] for bibrec in bibreclist: lists.append([bibrec, dbapi.get_possible_bibrecref([n[0] for n in pid_names], bibrec, always_match)]) return lists
def get_possible_bibrefs_from_pid_bibrec(pid, bibreclist, always_match=False): ''' Returns for each bibrec a list of bibrefs for which the surname matches. @param pid: person id to gather the names strings from @param bibreclist: list of bibrecs on which to search ''' pid = wash_integer_id(pid) pid_names = dbapi.get_person_names_set([pid]) lists = [] for bibrec in bibreclist: lists.append([ bibrec, dbapi.get_possible_bibrecref([n[0] for n in pid_names], bibrec, always_match) ]) return lists
def get_possible_bibrefs_from_pid_bibrec(pid, bibreclist, always_match=False, additional_names=None): ''' Returns for each bibrec a list of bibrefs for which the surname matches. @param pid: person id to gather the names strings from @param bibreclist: list of bibrecs on which to search @param always_match: match all bibrefs no matter the name @param additional_names: [n1,...,nn] names to match other then the one from personid ''' pid = wash_integer_id(pid) pid_names = dbapi.get_person_db_names_set(pid) if additional_names: pid_names += zip(additional_names) lists = [] for bibrec in bibreclist: lists.append([bibrec, dbapi.get_possible_bibrecref([n[0] for n in pid_names], bibrec, always_match)]) return lists