Spaces:
Configuration error
Configuration error
Update cross_encoder_reranking_train.py
Browse files
cross_encoder_reranking_train.py
CHANGED
@@ -29,8 +29,8 @@ def rank_by_centrality(texts):
|
|
29 |
return [text for text, _ in ranked]
|
30 |
|
31 |
def cluster_and_rank(texts, threshold=0.75):
|
32 |
-
if len(texts)
|
33 |
-
return texts
|
34 |
|
35 |
embeddings = embed_text_list(texts)
|
36 |
clustering = AgglomerativeClustering(n_clusters=None, distance_threshold=1-threshold, metric = "cosine", linkage='average')
|
|
|
29 |
return [text for text, _ in ranked]
|
30 |
|
31 |
def cluster_and_rank(texts, threshold=0.75):
|
32 |
+
if len(texts) < 2:
|
33 |
+
return texts
|
34 |
|
35 |
embeddings = embed_text_list(texts)
|
36 |
clustering = AgglomerativeClustering(n_clusters=None, distance_threshold=1-threshold, metric = "cosine", linkage='average')
|