def get_summed_tfidf(idx_list, len_output): if len(idx_list) == 0: return np.zeros(len_output) elif idx_list[0] == -1: return word_data_all_summed else: word_data = tfidf_vectors[idx_list, :] word_data = word_data.sum(axis=0) word_data = np.squeeze(np.asarray(word_data)) return word_data