@@ -78,8 +78,7 @@ def get_file():
78
78
# Make the main window of tkinter invisible since we only need the dialog.
79
79
root .withdraw ()
80
80
root .attributes ("-topmost" , True )
81
- filename = filedialog .askopenfilename (
82
- title = "Select a document to search for citations:" )
81
+ filename = filedialog .askopenfilename (title = "Select a document to search for citations:" )
83
82
root .destroy ()
84
83
return (filename )
85
84
@@ -197,8 +196,7 @@ def get_matches(target_document):
197
196
for index_no , citation in enumerate (second_authors ):
198
197
# Citation by citation, check and change all listed symbols
199
198
for phrase in starts_with_and :
200
- second_authors [index_no ] = second_authors [index_no ].replace (
201
- phrase , "" , 1 )
199
+ second_authors [index_no ] = second_authors [index_no ].replace (phrase , "" , 1 )
202
200
203
201
# Now we have two lists, all authors with year detected and only those who occur after an 'i'/'&'
204
202
# For each occuring in the second list, delete ONE from the first - so if theres A & B 2000 and also B 2000,
@@ -224,22 +222,19 @@ def get_matches(target_document):
224
222
)
225
223
226
224
# Combine all found cases into a single list
227
- all_found_citations = matches_single_author + \
228
- matches_multiple_authors + matches_author_et_al
225
+ all_found_citations = matches_single_author + matches_multiple_authors + matches_author_et_al
229
226
return (all_found_citations )
230
227
231
228
232
229
def remove_characters_adjust_phrases (list_of_matches , characters_to_remove , phrases_to_adjust ):
233
230
for index_no , citation in enumerate (list_of_matches ):
234
231
# Remove uneccessary characters
235
232
for char in characters_to_remove :
236
- list_of_matches [index_no ] = list_of_matches [index_no ].replace (
237
- char , "" )
233
+ list_of_matches [index_no ] = list_of_matches [index_no ].replace (char , "" )
238
234
239
235
# Change several phrases
240
236
for key in phrases_to_adjust :
241
- list_of_matches [index_no ] = list_of_matches [index_no ].replace (
242
- key , phrases_to_adjust [key ])
237
+ list_of_matches [index_no ] = list_of_matches [index_no ].replace (key , phrases_to_adjust [key ])
243
238
244
239
# Remove leading and trailing spaces with strip() to not confuse the duplicate detection
245
240
list_of_matches [index_no ] = list_of_matches [index_no ].strip ()
@@ -326,8 +321,7 @@ def write_excel(list_of_matches, filename):
326
321
workbook .close ()
327
322
328
323
print (f"Success! A file has been created at { output_filename } ." )
329
- print (
330
- f"A total of { len (list_of_matches )} different citations have been recorded." )
324
+ print (f"A total of { len (list_of_matches )} different citations have been recorded." )
331
325
input ("\n Press Enter to exit the program." )
332
326
333
327
# MAIN ----
0 commit comments