提交 9a3ad307 编写于 作者: B Behdad Esfahbod

[test] Remove unused hb-diff-ngrams

上级 b6b46002
......@@ -15,7 +15,6 @@ EXTRA_DIST += \
hb-diff \
hb-diff-colorize \
hb-diff-filter-failures \
hb-diff-ngrams \
hb-diff-stat \
hb-unicode-decode \
hb-unicode-encode \
......
#!/usr/bin/env python
from hb_test_tools import *
UtilMains.process_multiple_files (DiffSinks.print_ngrams)
......@@ -293,32 +293,6 @@ class DiffSinks:
total = passed + failed
print ("%d out of %d tests passed. %d failed (%g%%)" % (passed, total, failed, 100. * failed / total))
@staticmethod
def print_ngrams (f, ns=(1,2,3)):
gens = tuple (Ngram.generator (n) for n in ns)
allstats = Stats ()
allgrams = {}
for key, lines in DiffHelpers.separate_test_cases (f):
test = Test (lines)
allstats.add (test)
for gen in gens:
for ngram in gen (test.unicodes):
if ngram not in allgrams:
allgrams[ngram] = Stats ()
allgrams[ngram].add (test)
importantgrams = {}
for ngram, stats in allgrams.iteritems ():
if stats.failed.count >= 30: # for statistical reasons
importantgrams[ngram] = stats
allgrams = importantgrams
del importantgrams
for ngram, stats in allgrams.iteritems ():
print ("zscore: %9f failed: %6d passed: %6d ngram: <%s>" % (stats.zscore (allstats), stats.failed.count, stats.passed.count, ','.join ("U+%04X" % u for u in ngram)))
class Test:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册