def _save_hdf5(self, buffer_list):
"""
:param buffer_list:
:return:
"""
file_name = strftime("%Y-%m-%d-%H:%M:%S", gmtime())
output_path = os.path.join(self.data_store_path, file_name)
h5file = h5py.File(output_path, 'w', chunk=True)
dt_vlen = h5py.special_dtype(vlen=str)
dt_arr = np.dtype((dt_vlen, (self.sent_max_len,)))
h5raw = h5file.create_dataset('rawdata', (len(buffer_list),), dtype=dt_arr)
for i in range(len(buffer_list)):
h5raw[i] = np.array(buffer_list[i], dtype=object)
h5file.flush()
h5file.close()
评论列表
文章目录