Harsh502s commited on
Commit
6bb81d1
1 Parent(s): 27aa921

Reverse the sorting order of similar_topics in

Browse files
Files changed (1) hide show
  1. Pages/Models.py +2 -2
Pages/Models.py CHANGED
@@ -44,7 +44,7 @@ def tag_cnn_model(text):
44
  def output_keybert(text, n):
45
  new_review = text
46
  similar_topics, similarity = bertopic_model.find_topics(new_review, top_n=n)
47
- similar_topics = sorted(similar_topics)
48
  for i in range(n):
49
  tags = bertopic_model.get_topic(similar_topics[i], full=True)["KeyBERT"]
50
  tags = [tag[0] for tag in tags]
@@ -55,7 +55,7 @@ def output_keybert(text, n):
55
  def output_bertopic(text, n):
56
  new_review = text
57
  similar_topics, similarity = bertopic_model.find_topics(new_review, top_n=n)
58
- similar_topics = sorted(similar_topics)
59
  for i in range(n):
60
  tags = bertopic_model.get_topic(similar_topics[i])
61
  tags = [tag[0] for tag in tags]
 
44
  def output_keybert(text, n):
45
  new_review = text
46
  similar_topics, similarity = bertopic_model.find_topics(new_review, top_n=n)
47
+ similar_topics = sorted(similar_topics, reverse=True)
48
  for i in range(n):
49
  tags = bertopic_model.get_topic(similar_topics[i], full=True)["KeyBERT"]
50
  tags = [tag[0] for tag in tags]
 
55
  def output_bertopic(text, n):
56
  new_review = text
57
  similar_topics, similarity = bertopic_model.find_topics(new_review, top_n=n)
58
+ similar_topics = sorted(similar_topics, reverse=True)
59
  for i in range(n):
60
  tags = bertopic_model.get_topic(similar_topics[i])
61
  tags = [tag[0] for tag in tags]