wilmerags commited on
Commit
578e511
·
1 Parent(s): 1f3e17c

feat: Improve handling of not enough keywords topics

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -170,6 +170,8 @@ def generate_plot(
170
  except IndexError:
171
  break
172
  cluster_keyword[label].append(cluster_words[most_descriptive[0]])
 
 
173
  cluster_keyword[label] = ', '.join(cluster_keyword[label])
174
  encoded_labels_keywords = [cluster_keyword[encoded_label] for encoded_label in encoded_labels]
175
  embeddings_2d = get_tsne_embeddings(embeddings)
 
170
  except IndexError:
171
  break
172
  cluster_keyword[label].append(cluster_words[most_descriptive[0]])
173
+ if len(cluster_keyword[label]) == 1:
174
+ cluster_keyword[label] = cluster_keyword[label][0]
175
  cluster_keyword[label] = ', '.join(cluster_keyword[label])
176
  encoded_labels_keywords = [cluster_keyword[encoded_label] for encoded_label in encoded_labels]
177
  embeddings_2d = get_tsne_embeddings(embeddings)