The unified diff between revisions [5502da91..] and [aca48eab..] is displayed below. It can also be downloaded as a raw diff.

#
#
# patch "mk2.py"
#  from [347465bde5e18766879b3f3207985d278b8f711d]
#    to [5a6ddfdcab6cfff50ea025721abb21ddc65536a1]
#
============================================================
--- mk2.py	347465bde5e18766879b3f3207985d278b8f711d
+++ mk2.py	5a6ddfdcab6cfff50ea025721abb21ddc65536a1
@@ -1,5 +1,6 @@
 #!/usr/bin/env python

+import cPickle
 import heapq
 import math
 import sys
@@ -24,6 +25,9 @@ class MarkovState(object):
             self.h = self.__entropy()
         return self.h

+    def __repr__(self):
+        return repr(self.state)
+
     def __cmp__(self, other):
         if other == None:
             return -1
@@ -90,9 +94,12 @@ if __name__ == '__main__':

 if __name__ == '__main__':
     chain = MarkovChain(2)
+    if len(sys.argv) <> 3:
+        raise Exception("Usage: %s <file> <outfile.pk>" %sys.argv[0])
+    infile, outfile = sys.argv[1:]
     # first run through the mills..
     stash = []
-    chain.update(remember_gen (simple_gen (sys.argv[1]), stash))
+    chain.update(remember_gen (simple_gen (infile), stash))
     print "processing produced", len(chain.states.keys()), "states."
     while True:
         to_upchunk = chain.upchunk()
@@ -104,3 +111,4 @@ if __name__ == '__main__':
         stash = new_stash
         chain = new_chain
     print "final model formed and has", len(chain.states.keys()), "states."
+    cPickle.dump(chain, open(outfile, 'w'), protocol=2)