From 8cca761b911b6ec67dd2da98ec183809fedf2485 Mon Sep 17 00:00:00 2001 From: Ozbolt Menegatti Date: Wed, 21 Aug 2019 11:11:06 +0200 Subject: [PATCH] min frequecy now part of writer --- src/match_store.py | 1 - src/writer.py | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/match_store.py b/src/match_store.py index 0297c64..29aaba1 100644 --- a/src/match_store.py +++ b/src/match_store.py @@ -8,7 +8,6 @@ from progress_bar import progress class MatchStore: def __init__(self, args, db): self.db = db - self.min_frequency = args.min_freq self.dispersions = {} self.match_num = 0 diff --git a/src/writer.py b/src/writer.py index 13451da..9e3e96d 100644 --- a/src/writer.py +++ b/src/writer.py @@ -6,7 +6,7 @@ from formatter import OutFormatter, OutNoStatFormatter, AllFormatter, StatsForma class Writer: @staticmethod def other_params(args): - return (args.multiple_output, int(args.sort_by), args.sort_reversed) + return (args.multiple_output, int(args.sort_by), args.sort_reversed, args.min_freq) @staticmethod def make_output_writer(args, num_components, colocation_ids, word_renderer): @@ -32,10 +32,12 @@ class Writer: self.multiple_output = False self.sort_by = -1 self.sort_order = None + self.min_frequency = 1 else: self.multiple_output = params[0] self.sort_by = params[1] self.sort_order = params[2] + self.min_frequency = params[3] self.num_components = num_components self.output_file = file_out @@ -76,6 +78,9 @@ class Writer: components = structure.components for match in colocation_ids.get_matches_for(structure): + if len(match) < self.min_frequency: + continue + self.formatter.new_match(match) for words in match.matches: