[test] Remove unused hb-diff-ngrams

This commit is contained in:
Behdad Esfahbod 2018-01-09 21:35:21 +01:00
parent b6b460024d
commit 9a3ad307ea
3 changed files with 0 additions and 32 deletions

View File

@ -15,7 +15,6 @@ EXTRA_DIST += \
hb-diff \ hb-diff \
hb-diff-colorize \ hb-diff-colorize \
hb-diff-filter-failures \ hb-diff-filter-failures \
hb-diff-ngrams \
hb-diff-stat \ hb-diff-stat \
hb-unicode-decode \ hb-unicode-decode \
hb-unicode-encode \ hb-unicode-encode \

View File

@ -1,5 +0,0 @@
#!/usr/bin/env python
from hb_test_tools import *
UtilMains.process_multiple_files (DiffSinks.print_ngrams)

View File

@ -293,32 +293,6 @@ class DiffSinks:
total = passed + failed total = passed + failed
print ("%d out of %d tests passed. %d failed (%g%%)" % (passed, total, failed, 100. * failed / total)) 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: class Test: