adding timeinfo

This commit is contained in:
2019-08-21 11:13:23 +02:00
parent 2018745d52
commit 046aef031f
2 changed files with 25 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ from word_stats import WordStats
from writer import Writer
from loader import load_files
from database import Database
from time_info import TimeInfo
def match_file(words, structures):
@@ -38,6 +39,7 @@ def match_file(words, structures):
def main(args):
structures, lemma_msds, max_num_components = build_structures(args)
timeinfo = TimeInfo(len(args.input))
database = Database(args)
match_store = MatchStore(args, database)
@@ -45,8 +47,10 @@ def main(args):
for words in load_files(args, database):
if words is None:
timeinfo.add_measurement(-1)
continue
start_time = time.time()
matches = match_file(words, structures)
match_store.add_matches(matches)
word_stats.add_words(words)
@@ -57,6 +61,9 @@ def main(args):
del matches
gc.collect()
timeinfo.add_measurement(time.time() - start_time)
timeinfo.info()
# if no output files, just exit
if all([x == None for x in [args.out, args.out_no_stat, args.all, args.stats]]):
return