def main(): loaded = stream.load(sys.stdin) merged = makehash() for k1 in loaded: merged[k1] = SemiMarkov() for k2 in loaded[k1]: merged[k1] += loaded[k1][k2] stream.dump(k1, merged[k1])
def main(): models = defaultdict(SemiMarkov) for line in sys.stdin: splitted = line.strip().split('\t') if len(splitted) == 2: update(models, *splitted) for key, model in models.items(): stream.dump(key, model)
def write_documents_to_file(self, path, documents, buffer_size=10): """ Write list of Documents messages to binary file. """ stream.dump(path, *documents, buffer_size=buffer_size)