def get_person_last_names(cand: DataPoint) -> DataPoint: """ Returns the last names for the two person mentions in candidate """ cand = get_person_text(cand) person1_name, person2_name = cand.person_names person1_lastname = (person1_name.split(" ")[-1] if len(person1_name.split(" ")) > 1 else None) person2_lastname = (person2_name.split(" ")[-1] if len(person2_name.split(" ")) > 1 else None) cand.person_lastnames = [person1_lastname, person2_lastname] return cand
def get_persons_last_name(cand: DataPoint) -> DataPoint: """ Returns entity last names. :param cand: A candidate DF. :return: Candidate DF with a new column, a list of last names. """ cand = get_person_text(cand) person1_name, person2_name = cand.person_names person1_last_name = (person1_name.split(" ")[-1] if len(person1_name.split(" ")) > 1 else None) person2_last_name = (person2_name.split(" ")[-1] if len(person2_name.split(" ")) > 1 else None) cand.person_lastnames = [person1_last_name, person2_last_name] return cand