(author, existing_authors)
| 173 | |
| 174 | |
| 175 | def author_found_in_existing_authors(author, existing_authors): |
| 176 | existing_author_names = ExistingAuthorNames(existing_authors) |
| 177 | |
| 178 | names = author.split() |
| 179 | first_name = unidecode(names[0].replace(",", "")) |
| 180 | last_name = unidecode(names[-1]) |
| 181 | |
| 182 | if existing_author_names.last_name_matches_surname_and_first_name_or_first_letter_matches_given_name( |
| 183 | last_name, first_name |
| 184 | ): |
| 185 | return True |
| 186 | |
| 187 | if existing_author_names.first_name_matches_surname_and_last_name_matches_given_name( |
| 188 | first_name, last_name |
| 189 | ): |
| 190 | return True |
| 191 | |
| 192 | if existing_author_names.surname_matches_whole_author_name(author): |
| 193 | return True |
| 194 | |
| 195 | if existing_author_names.given_name_matches_matches_whole_author_name(author): |
| 196 | return True |
| 197 | |
| 198 | if existing_author_names.combined_name_matches_whole_author_name(author): |
| 199 | return True |
| 200 | |
| 201 | if existing_author_names.combined_name_reversed_matches(author): |
| 202 | return True |
| 203 | |
| 204 | if existing_author_names.author_name_is_first_initial_and_surname_concatenated( |
| 205 | author |
| 206 | ): |
| 207 | return True |
| 208 | |
| 209 | return False |
| 210 | |
| 211 | |
| 212 | def is_nonhuman(author: str) -> bool: |
no test coverage detected