raise ComparatorException("couldn't extracrt file text")
self.cliques = filtered
+class CommonStatistics:
+ "Statistical information from a report."
+ def __init__(self, report):
+ self.chunks = report.segment_count()
+ self.trees = []
+ for (tree, totallines) in report.trees.items():
+ lines = report.line_count(tree)
+ self.trees.append((tree, lines, totallines))
+
+ def __str__(self):
+ rep = "%d overlaps\n" % self.chunks
+ for (tree, lines, total) in self.trees:
+ rep += "%s:%d:%d\n" % (tree, lines, total)
+ return rep
state.filter_by_significance()
if stats:
- print "%d overlaps" % state.segment_count()
- for (tree, totallines) in state.trees.items():
- lines = state.line_count(tree)
- print "%s:%d:%d" % (tree, lines, state.trees[tree])
+ sys.stdout.write(str(comparator.CommonStatistics(state)))
else:
report_common(state)
except comparator.ComparatorException, e: