The unified diff between revisions [6566c817..] and [8f58bb18..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'mk2.py'
#
#
# patch "mk2.py"
# from [a7028cf9ec6b8a7ed3584edd7c2adc04e5ffbe51]
# to [b5da43536911ecf9293ffb03ec84abf7eefda811]
#
============================================================
--- mk2.py a7028cf9ec6b8a7ed3584edd7c2adc04e5ffbe51
+++ mk2.py b5da43536911ecf9293ffb03ec84abf7eefda811
@@ -86,19 +86,15 @@ class MarkovChain(object):
self.clear()
self.update(self.__upchunk_gen (stash_copy, to_upchunk))
del stash_copy
-
- def entropy_sort(self):
+
+ def __select_upchunk(self):
q = []
keys = self.states.keys()
if len(keys) == 0:
- return q
+ return None
for idx, tokens in enumerate(keys):
state = self.states[tokens]
heapq.heappush(q, state)
- return q
-
- def __select_upchunk(self):
- q = self.entropy_sort ()
cutoff = math.log (len (keys), 2) / 4
candidate = heapq.heappop(q)
print >>sys.stderr, "best entropy vs. cutoff is: %s :: %.2f vs. cutoff %.2f" % (candidate.state, candidate.entropy(), cutoff)