MCPcopy Create free account
hub / github.com/bab2min/tomotopy / getTopicWords

Method getTopicWords

src/python/handler/py_LDA.cpp:322–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320}
321
322py::UniqueObj LDAModelObject::getTopicWords(size_t topicId, size_t topN, bool returnId) const
323{
324 auto* inst = getInst<tomoto::ILDAModel>();
325 if (topicId >= inst->getK()) throw py::ValueError{ "topic_id must < K" };
326
327 if (returnId)
328 {
329 return py::buildPyValue(inst->getWordIdsByTopicSorted(topicId, topN));
330 }
331 else
332 {
333 return py::buildPyValue(inst->getWordsByTopicSorted(topicId, topN));
334 }
335}
336
337std::vector<tomoto::Float> LDAModelObject::getTopicWordDist(size_t topicId, bool normalize) const
338{

Callers

nothing calls this directly

Calls 4

getWordsByTopicSortedMethod · 0.80
buildPyValueFunction · 0.70
getKMethod · 0.45

Tested by

no test coverage detected