def store (self) : transcripts.printf_information ('Storing data to stream [%s]...', self.data_path) stream = streams.open (self.data_path, 'o') if stream is None : transcripts.printf_warning ('Stream does not exist; aborting.') pickle.dump (self.document_identifiers, stream) pickle.dump (self.document_titles, stream) pickle.dump (self.document_contents, stream) pickle.dump (self.document_vectors, stream) stream.close ()
def load (self) : transcripts.printf_information ('Loading data from stream [%s]...', self.data_path) stream = streams.open (self.data_path, 'i') if stream is None : transcripts.printf_warning ('Stream does not exist; aborting.') return self.document_identifiers = pickle.load (stream) self.document_titles = pickle.load (stream) self.document_contents = pickle.load (stream) self.document_vectors = pickle.load (stream) stream.close ()