application_6.py 348 B

12345678910
  1. def get_summed_tfidf(idx_list, len_output):
  2. if len(idx_list) == 0:
  3. return np.zeros(len_output)
  4. elif idx_list[0] == -1:
  5. return word_data_all_summed
  6. else:
  7. word_data = tfidf_vectors[idx_list, :]
  8. word_data = word_data.sum(axis=0)
  9. word_data = np.squeeze(np.asarray(word_data))
  10. return word_data