| 425 | } |
| 426 | |
| 427 | py::UniqueObj LDAModelObject::saves(const std::vector<uint8_t>& extraData, bool full) |
| 428 | { |
| 429 | auto* inst = getInst<tomoto::ILDAModel>(); |
| 430 | if (!isPrepared) |
| 431 | { |
| 432 | inst->prepare(true, minWordCnt, minWordDf, removeTopWord); |
| 433 | isPrepared = true; |
| 434 | } |
| 435 | ostringstream str; |
| 436 | inst->saveModel(str, !!full, &extraData); |
| 437 | return py::UniqueObj{ PyBytes_FromStringAndSize(str.str().data(), str.str().size()) }; |
| 438 | } |
| 439 | |
| 440 | void LDAModelObject::updateVocab(const std::vector<std::string>& newVocabs) |
| 441 | { |