| 1245 | } |
| 1246 | |
| 1247 | void PhraserObject::save(const std::string& path) const |
| 1248 | { |
| 1249 | ofstream ofs{ path, ios_base::binary }; |
| 1250 | if (!ofs) throw py::OSError{ string{"cannot write to '"} + path + "'" }; |
| 1251 | tomoto::serializer::writeMany(ofs, tomoto::serializer::to_keyz("tph1"), |
| 1252 | vocabs, |
| 1253 | cand_info, |
| 1254 | trie_nodes |
| 1255 | ); |
| 1256 | } |
| 1257 | |
| 1258 | py::UniqueCObj<PhraserObject> PhraserObject::load(PyObject* cls, const std::string& path) |
| 1259 | { |