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

Method getTopicPrior

src/python/handler/py_DMR.cpp:121–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121std::vector<float> DMRModelObject::getTopicPrior(const std::string& metadata, PyObject* multiMetadata, bool raw) const
122{
123 auto* inst = getInst<tomoto::IDMRModel>();
124 if (multiMetadata && PyUnicode_Check(multiMetadata))
125 {
126 if (PyErr_WarnEx(PyExc_RuntimeWarning, "`multi_metadata` should be an iterable of str.", 1)) throw py::ExcPropagation{};
127 }
128
129 vector<string> multiMd;
130 if (multiMetadata)
131 {
132 if (!py::toCpp<vector<string>>(multiMetadata, multiMd))
133 {
134 throw py::ValueError{
135 "`multi_metadata` must be an instance of `List[str]` (but given " + py::repr(multiMetadata) + ")"
136 };
137 }
138 }
139 return inst->getTopicPrior(metadata, multiMd, raw);
140}
141
142py::UniqueCObj<VocabObject> DMRModelObject::getMetadataDict() const
143{

Callers

nothing calls this directly

Calls 1

reprFunction · 0.85

Tested by

no test coverage detected