| 411 | } |
| 412 | |
| 413 | void LDAModelObject::save(const std::string& filename, const std::vector<uint8_t>& extraData, bool full) |
| 414 | { |
| 415 | auto* inst = getInst<tomoto::ILDAModel>(); |
| 416 | if (!isPrepared) |
| 417 | { |
| 418 | inst->prepare(true, minWordCnt, minWordDf, removeTopWord); |
| 419 | isPrepared = true; |
| 420 | } |
| 421 | ofstream str{ filename, ios_base::binary }; |
| 422 | if (!str) throw py::OSError{ std::string("cannot open file '") + filename + std::string("'") }; |
| 423 | |
| 424 | inst->saveModel(str, !!full, &extraData); |
| 425 | } |
| 426 | |
| 427 | py::UniqueObj LDAModelObject::saves(const std::vector<uint8_t>& extraData, bool full) |
| 428 | { |