def single_pass(self, texts):
    texts_cut = self.cut_sentences(texts)
    tfidf = self.get_tfidf(texts_cut)
    for (idx, vec) in enumerate(tfidf):
        if (not self.cluster_center_vec):
            self.cluster_center_vec.append(vec)
            self.cluster_2_idx[0] = [idx]
        else:
            (max_simi, max_idx) = self.cosion_simi(vec)
            if (max_simi >= self.simi_thr):
                self.cluster_2_idx[max_idx].append(idx)
            else:
                self.cluster_center_vec.append(vec)
                self.cluster_2_idx[len(self.cluster_2_idx)] = [idx]
    with open(self.res_path, 'w', encoding='utf-8') as f:
        json.dump(self.cluster_2_idx, f, ensure_ascii=False)
def single_pass(self, texts):
    texts_cut = self.cut_sentences(texts)
    tfidf = self.get_tfidf(texts_cut)
    for (idx, vec) in enumerate(tfidf):
        if (not self.cluster_center_vec):
            self.cluster_center_vec.append(vec)
            self.cluster_2_idx[0] = [idx]
        else:
            (max_simi, max_idx) = self.cosion_simi(vec)
            if (max_simi >= self.simi_thr):
                self.cluster_2_idx[max_idx].append(idx)
            else:
                self.cluster_center_vec.append(vec)
                self.cluster_2_idx[len(self.cluster_2_idx)] = [idx]
    with open(self.res_path, 'w', encoding='utf-8') as f:
        json.dump(self.cluster_2_idx, f, ensure_ascii=False)