| 965 | } |
| 966 | |
| 967 | std::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 | |
| 981 | std::vector<std::pair<std::string, tomoto::Float>> DocumentObject::getWords(size_t topN) const |
| 982 | { |
nothing calls this directly
no test coverage detected