YchKhan commited on
Commit
022e3b8
1 Parent(s): d45e955

Update classification.py

Browse files
Files changed (1) hide show
  1. classification.py +5 -5
classification.py CHANGED
@@ -181,7 +181,7 @@ def match_categories(df, category_df, treshold=0.45):
181
  categories_list.append("@~@".join([category_df.loc[index, 'description'] for index in high_score_indices]))
182
  experts_list.append("@~@".join(["@~@".join(list(set(category_df.loc[index, 'experts']))) for index in high_score_indices]))
183
  topic_list.append("@~@".join([category_df.loc[index, 'topic'] for index in high_score_indices]))
184
- scores_list.append("@~@".join(["@~@".join(str(float(cos_scores[index])) for index in high_score_indices)]))
185
  for j in high_score_indices:
186
  df.loc[index, category_df.loc[j, 'topic']] = float(cos_scores[j])
187
  else:
@@ -189,10 +189,10 @@ def match_categories(df, category_df, treshold=0.45):
189
  experts_list.append(np.nan)
190
  topic_list.append(np.nan)
191
  scores_list.append(np.nan)
192
- df["Description"] = categories_list
193
- df["Expert"] = experts_list
194
- df["Topic"] = topic_list
195
- df["Score"] = scores_list
196
  return df
197
 
198
 
 
181
  categories_list.append("@~@".join([category_df.loc[index, 'description'] for index in high_score_indices]))
182
  experts_list.append("@~@".join(["@~@".join(list(set(category_df.loc[index, 'experts']))) for index in high_score_indices]))
183
  topic_list.append("@~@".join([category_df.loc[index, 'topic'] for index in high_score_indices]))
184
+ scores_list.append("@~@".join([str(float(cos_scores[index])) for index in high_score_indices]))
185
  for j in high_score_indices:
186
  df.loc[index, category_df.loc[j, 'topic']] = float(cos_scores[j])
187
  else:
 
189
  experts_list.append(np.nan)
190
  topic_list.append(np.nan)
191
  scores_list.append(np.nan)
192
+ df["Description"] = categories_list
193
+ df["Expert"] = experts_list
194
+ df["Topic"] = topic_list
195
+ df["Score"] = scores_list
196
  return df
197
 
198