2011-09-30 | Paul Boddie | file changeset files shortlog | Added the initial version of the indexing module and some test programs to demonstrate the motivation behind the project. |
paul@0 | 1 | #!/usr/bin/env python |
paul@0 | 2 | |
paul@0 | 3 | from simplex import * |
paul@0 | 4 | import sys, time |
paul@0 | 5 | |
paul@0 | 6 | filename = sys.argv[1] |
paul@0 | 7 | terms = sys.argv[2:] |
paul@0 | 8 | |
paul@0 | 9 | f = open(filename) |
paul@0 | 10 | try: |
paul@0 | 11 | for term in terms: |
paul@0 | 12 | f.seek(0) |
paul@0 | 13 | |
paul@0 | 14 | t = time.time() |
paul@0 | 15 | line = find_line_in_file(f, term) |
paul@0 | 16 | if line: |
paul@0 | 17 | print "Found (at %s seconds)...\n%s" % (time.time() - t, line) |
paul@0 | 18 | finally: |
paul@0 | 19 | f.close() |
paul@0 | 20 | |
paul@0 | 21 | # vim: tabstop=4 expandtab shiftwidth=4 |