| 74 | } |
| 75 | |
| 76 | py::UniqueObj extract(PyObject* arg) |
| 77 | { |
| 78 | auto tm = py::checkType<py::PObject<LDAModelObject>>(arg, "tm must be a tomotopy.LDAModel instance."); |
| 79 | auto cands = inst->extract(tm->value.inst.get()); |
| 80 | py::UniqueObj ret = py::UniqueObj{ PyList_New(0) }; |
| 81 | for (auto& c : cands) |
| 82 | { |
| 83 | auto item = py::makeNewObject<CandidateObject>(); |
| 84 | item->tm = py::UniquePObj<LDAModelObject>{ tm }; |
| 85 | item->tm.incref(); |
| 86 | item->cand = move(c); |
| 87 | PyList_Append(ret.get(), (PyObject*)item.get()); |
| 88 | } |
| 89 | return ret; |
| 90 | } |
| 91 | }; |
| 92 | |
| 93 | struct FoRelevanceObject : public py::CObject<FoRelevanceObject> |