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

Method getTopicDist

src/python/handler/py_utils.cpp:967–979  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

965}
966
967std::vector<float> DocumentObject::getTopicDist(bool normalize, bool fromPseudoDoc) const
968{
969 if (corpus->isIndependent()) throw py::RuntimeError{ "This method can only be called by documents bound to the topic model." };
970 if (!corpus->tm->inst) throw py::RuntimeError{ "inst is null" };
971 if (!corpus->tm->isPrepared) throw py::RuntimeError{ "train() should be called first for calculating the topic distribution" };
972
973 if (owner && !initialized)
974 {
975 if (PyErr_WarnEx(PyExc_RuntimeWarning, "This document has no topic information. Call `infer()` method passing this document as an argument first!", 1)) throw py::ExcPropagation{};
976 }
977 if (fromPseudoDoc) return getTopicDistFromPseudoDoc(normalize);
978 return corpus->tm->inst->getTopicsByDoc(getBoundDoc(), normalize);
979}
980
981std::vector<std::pair<std::string, tomoto::Float>> DocumentObject::getWords(size_t topN) const
982{

Callers

nothing calls this directly

Calls 2

isIndependentMethod · 0.80
getTopicsByDocMethod · 0.80

Tested by

no test coverage detected