Milad Alshomary commited on
Commit
161cb59
·
1 Parent(s): e5d9888
utils/gram2vec_feat_utils.py CHANGED
@@ -144,7 +144,7 @@ def show_combined_spans_all(selected_feature_llm, selected_feature_g2v,
144
  background_authors_embeddings_df = background_authors_embeddings_df[background_authors_embeddings_df.authorID.isin(visible_authors)]
145
  background_and_task_authors = pd.concat([task_authors_embeddings_df, background_authors_embeddings_df])
146
 
147
- authors_texts = ['\n\n =========== \n\n'.join(x) if type(x) == list else x for x in background_and_task_authors[:max_num_authors]['fullText'].tolist()]
148
  authors_names = background_and_task_authors[:max_num_authors]['authorID'].tolist()
149
  print(f"Number of authors to show: {len(authors_texts)}")
150
  print(f"Authors names: {authors_names}")
 
144
  background_authors_embeddings_df = background_authors_embeddings_df[background_authors_embeddings_df.authorID.isin(visible_authors)]
145
  background_and_task_authors = pd.concat([task_authors_embeddings_df, background_authors_embeddings_df])
146
 
147
+ authors_texts = ['\n\n'.join(x) if type(x) == list else x for x in background_and_task_authors[:max_num_authors]['fullText'].tolist()]
148
  authors_names = background_and_task_authors[:max_num_authors]['authorID'].tolist()
149
  print(f"Number of authors to show: {len(authors_texts)}")
150
  print(f"Authors names: {authors_names}")
utils/ui.py CHANGED
@@ -162,8 +162,8 @@ def task_HTML(mystery_text, candidate_texts, predicted_author, ground_truth_auth
162
 
163
  # if any of the texts is a list of text then concatenate them
164
  if isinstance(mystery_text, list):
165
- mystery_text = "\n\n".join(["Text: {}".format(x) for x in mystery_text])
166
- candidate_texts = ["\n\n".join(["Text: {}".format(t) for t in x]) for x in candidate_texts]
167
 
168
  header_html = f"""
169
  <div style="border:1px solid #ccc; padding:10px; margin-bottom:10px;">
 
162
 
163
  # if any of the texts is a list of text then concatenate them
164
  if isinstance(mystery_text, list):
165
+ mystery_text = "\n\n".join(mystery_text)
166
+ candidate_texts = ["\n\n".join(x) for x in candidate_texts]
167
 
168
  header_html = f"""
169
  <div style="border:1px solid #ccc; padding:10px; margin-bottom:10px;">
utils/visualizations.py CHANGED
@@ -305,7 +305,7 @@ def handle_zoom(event_json, bg_proj, bg_lbls, clustered_authors_df, task_authors
305
  task_only_df = task_authors_df
306
 
307
  def _to_text(x):
308
- return '\n\n =========== \n\n'.join(x) if isinstance(x, list) else x
309
 
310
  task_texts = [_to_text(x) for x in task_only_df['fullText'].tolist()]
311
 
 
305
  task_only_df = task_authors_df
306
 
307
  def _to_text(x):
308
+ return '\n\n'.join(x) if isinstance(x, list) else x
309
 
310
  task_texts = [_to_text(x) for x in task_only_df['fullText'].tolist()]
311