@timefun def confusion_matrix_bench(): reference = 'This is the reference data. Testing 123. aoaeoeoe' test = 'Thos iz_the rifirenci data. Testeng 123. aoaeoeoe' ConfusionMatrix(raw_text1,raw_text1) @timefun def stemming_bench(): [stemmer.stem(w) for w in machado.words('romance/marm05.txt')] #@timefun #def feat_grammar_parse_wbind_bench(): # trees = cp2.nbest_parse('john feeds a dog. The dog barks'.split()) if __name__=="__main__": concordance_bench() similar_bench() collocations_bench() #generate_bench() freqdist_bench() sent_tokenizer_bench() feat_grammar_parse_bench() # feat_grammar_parse_wbind_bench() confusion_matrix_bench() stemming_bench() if 'PyPy' in version: print ("building report:") report.build()
from bisect import bisect_left from datetime import date from datetime import time from datetime import datetime from datetime import timedelta from report import build #view from activity import foo, sum_dict from config import config xs = sum(foo(date(2012, 12, 21), date(2012, 12, 30)), []) ys = sum_dict(xs).items() data = sorted(ys, key=lambda p: p[0]) keys = [r[0] for r in data] def bar(start, d, h): t = datetime.combine(start, time()) + d + h idx = bisect_left(keys, t) print 'query:', t print 'reply:' print data[idx][0] r = '\n'.join(data[idx][1]) print r return r build(config['output'], date(2012, 12, 23),bar)