| 950 | } |
| 951 | |
| 952 | std::vector<std::pair<tomoto::Tid, tomoto::Float>> DocumentObject::getTopics(size_t topN, bool fromPseudoDoc) const |
| 953 | { |
| 954 | if (corpus->isIndependent()) throw py::RuntimeError{ "This method can only be called by documents bound to the topic model." }; |
| 955 | if (!corpus->tm->inst) throw py::RuntimeError{ "inst is null" }; |
| 956 | if (!corpus->tm->isPrepared) throw py::RuntimeError{ "train() should be called first for calculating the topic distribution" }; |
| 957 | |
| 958 | if (owner && !initialized) |
| 959 | { |
| 960 | 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{}; |
| 961 | } |
| 962 | |
| 963 | if (fromPseudoDoc) return getTopicsFromPseudoDoc(topN); |
| 964 | return corpus->tm->inst->getTopicsByDocSorted(getBoundDoc(), topN); |
| 965 | } |
| 966 | |
| 967 | std::vector<float> DocumentObject::getTopicDist(bool normalize, bool fromPseudoDoc) const |
| 968 | { |
nothing calls this directly
no test coverage detected