in aidial_analytics_realtime/topic_model.py [0:0]
def _get_topic_by_text(self, text: str) -> str | None:
text = text.strip()
if not text:
return None
topics, _ = self.model.transform([text])
topic = self.model.get_topic_info(topics[0])
if "GeneratedName" in topic:
# "GeneratedName" is an expected name for the human readable topic representation
return topic["GeneratedName"][0][0][0] # type: ignore
return topic["Name"][0] # type: ignore