aboltachka commited on
Commit
d42f630
1 Parent(s): d7f3d30

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -6
app.py CHANGED
@@ -320,9 +320,12 @@ def rr_detector(title_raw, abstract_raw):
320
  for e,l in groups:
321
  results[f'match_{int(e)}'] = 0
322
  for i in l:
323
- if result_dict[f'ethnicity_{int(i)}_t_c'] > 0:
324
- if result_dict[f'group_{int(e)}']*result_dict['issue_s_at_m'] > 0 and results.get(f'match_{int(e)}', 0) != 1:
325
- results[f'match_{int(e)}'] = 1
 
 
 
326
  result_dict.update(results)
327
 
328
  results = {}
@@ -440,14 +443,21 @@ def rr_detector(title_raw, abstract_raw):
440
 
441
  #FORM THE MAIN OUTPUT
442
  #Output
443
- if result_dict['match_1'] == 1:
444
  #Result
445
  output_image = os.path.join(dirname, 'images/yes.png')
446
  #Explanation
447
  unique_group_str = ', '.join(unique_group)
448
  unique_issue_str = ', '.join(unique_issue)
449
- answer = "This paper can be considered race-related, as it mentions at least one group keyword AND one topic keywords in title or abstract. Furthermore, the algorithm does not identify any blackball phrases in the title and abstract provided."
450
-
 
 
 
 
 
 
 
451
  else:
452
 
453
  if len(blackball_count) > 0:
 
320
  for e,l in groups:
321
  results[f'match_{int(e)}'] = 0
322
  for i in l:
323
+ if result_dict[f'ethnicity_{int(i)}_t_c'] > 0 and results.get(f'match_{int(e)}', 0) != 1 :
324
+ results[f'match_{int(e)}'] = 1
325
+ tag = 'case1' #at least one GROUP keyword is in the title
326
+ elif result_dict[f'group_{int(e)}']*result_dict['issue_s_at_m'] > 0 and results.get(f'match_{int(e)}', 0) != 1:
327
+ results[f'match_{int(e)}'] = 1
328
+ tag = 'case2' #OR at least one group keyword and at least one issue keyword are mentioned in the title or abstract
329
  result_dict.update(results)
330
 
331
  results = {}
 
443
 
444
  #FORM THE MAIN OUTPUT
445
  #Output
446
+ if result_dict['match_1'] == 1 and tag == "case1":
447
  #Result
448
  output_image = os.path.join(dirname, 'images/yes.png')
449
  #Explanation
450
  unique_group_str = ', '.join(unique_group)
451
  unique_issue_str = ', '.join(unique_issue)
452
+ answer = "This paper can be considered race-related, as it mentions at least one group keyword in the title. Furthermore, the algorithm does not identify any whitelist phrases in the title and abstract provided."
453
+ elif result_dict['match_1'] == 1 and tag == "case2":
454
+ #Result
455
+ output_image = os.path.join(dirname, 'images/yes.png')
456
+ #Explanation
457
+ unique_group_str = ', '.join(unique_group)
458
+ unique_issue_str = ', '.join(unique_issue)
459
+ answer = "This paper can be considered race-related, as it mentions at least one group keyword AND at least one issue keyword in the title or abstract (excluding the last sentence). Furthermore, the algorithm does not identify any whitelist phrases in the title and abstract provided."
460
+
461
  else:
462
 
463
  if len(blackball_count) > 0: