コード例 #1
0
def tree_constructor():
    """Times the construction of a suffix tree object from file."""
    t0 = time.time()
    tree.tree_by_file(DATA_FILE, False)
    t1 = time.time()

    return t1 - t0
コード例 #2
0
def tree_substring():
    data = tree.tree_by_file(DATA_FILE, False)

    substr = ''
    with open(SUBSTR_FILE, 'r') as f:
        for line in f:
            substr += line.upper()

    t0 = time.time()
    data.has_substring(substr)
    t1 = time.time()
    return t1 - t0