m7n commited on
Commit
184fac5
·
verified ·
1 Parent(s): 4419e34

Update app.py

Browse files

added publication-parsing

Files changed (1) hide show
  1. app.py +22 -0
app.py CHANGED
@@ -54,6 +54,16 @@ from tqdm import tqdm
54
 
55
 
56
 
 
 
 
 
 
 
 
 
 
 
57
  def query_records(search_term):
58
  def invert_abstract(inv_index):
59
  if inv_index is not None:
@@ -62,6 +72,16 @@ def query_records(search_term):
62
  else:
63
  return ' '
64
 
 
 
 
 
 
 
 
 
 
 
65
  # Fetch records based on the search term
66
  query = Works().search_filter(abstract=search_term)
67
 
@@ -71,6 +91,8 @@ def query_records(search_term):
71
 
72
  records_df = pd.DataFrame(records)
73
  records_df['abstract'] = [invert_abstract(t) for t in records_df['abstract_inverted_index']]
 
 
74
 
75
  return records_df
76
 
 
54
 
55
 
56
 
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
  def query_records(search_term):
68
  def invert_abstract(inv_index):
69
  if inv_index is not None:
 
72
  else:
73
  return ' '
74
 
75
+ def get_pub(x):
76
+ try:
77
+ source = x['source']['display_name']
78
+ if source not in ['parsed_publication','Deleted Journal']:
79
+ return source
80
+ else:
81
+ return ' '
82
+ except:
83
+ return ' '
84
+
85
  # Fetch records based on the search term
86
  query = Works().search_filter(abstract=search_term)
87
 
 
91
 
92
  records_df = pd.DataFrame(records)
93
  records_df['abstract'] = [invert_abstract(t) for t in records_df['abstract_inverted_index']]
94
+ records_df['parsed_publication'] = [get_pub(x) for x in records_df['primary_location']]
95
+
96
 
97
  return records_df
98