Commit c8259dff authored by De Silva K.C.C.C's avatar De Silva K.C.C.C

get topics fn

parent 7b14a9fc
import nltk import nltk
import question_generator as q_gen import question_generator as q_gen
# nltk.download('words')
from bertopic import BERTopic from bertopic import BERTopic
from nltk.corpus import words from nltk.corpus import words
...@@ -18,12 +18,11 @@ def get_topics(file): ...@@ -18,12 +18,11 @@ def get_topics(file):
docs.append(line.rstrip()) docs.append(line.rstrip())
topics, probabilities = model.fit_transform(docs) topics, probabilities = model.fit_transform(docs)
#
print(model.get_topic_freq()) print(model.get_topic_freq())
#
print('done') print('done')
#
# model.get_topic_freq().head(11)
print(model.get_topics()) print(model.get_topics())
...@@ -39,5 +38,4 @@ def get_topics(file): ...@@ -39,5 +38,4 @@ def get_topics(file):
def get_topics_new(text): def get_topics_new(text):
topics = q_gen.get_keywords(text, q_gen.summarizer(text)) topics = q_gen.get_keywords(text, q_gen.summarizer(text))
# print(topics)
return topics return topics
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment