1 #!/usr/bin/env python 2 3 from simplex import * 4 import sys, time 5 6 filename, step = sys.argv[1:3] 7 terms = sys.argv[3:] 8 9 f = open(filename) 10 tf = TextFile(f) 11 try: 12 t = time.time() 13 l = index_file(tf, int(step)) 14 print "Indexed in %s seconds." % (time.time() - t) 15 16 # Now use the index. 17 18 for term in terms: 19 t = time.time() 20 line = find_with_index(tf, l, term) 21 if line: 22 print "Found (at %s seconds)...\n%s" % (time.time() - t, line) 23 24 finally: 25 f.close() 26 27 # vim: tabstop=4 expandtab shiftwidth=4