From 32c9f1bbf89ea71ac4b216b6179a6fb82ee5375a Mon Sep 17 00:00:00 2001 From: Victor Zimmermann <zimmermann@cl.uni-heidelberg.de> Date: Wed, 21 Mar 2018 18:25:32 +0100 Subject: [PATCH] Added maximum context size option. --- src/absinth.py | 3 ++- src/config.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/absinth.py b/src/absinth.py index d6d22ae..5c16425 100644 --- a/src/absinth.py +++ b/src/absinth.py @@ -206,6 +206,7 @@ def process_file(context_list: list, target_string: str, stopword_list = config.stop_words allowed_tag_list = config.allowed_tags min_context_size = config.min_context_size + max_context_size = config.max_context_size try: @@ -241,7 +242,7 @@ def process_file(context_list: list, target_string: str, context_size = len(token_set) - if context_size >= min_context_size: + if context_size >= min_context_size and context_size <= max_context_size: for token in token_set: if token in node_freq_dict: diff --git a/src/config.py b/src/config.py index 01a0a9e..a823503 100644 --- a/src/config.py +++ b/src/config.py @@ -41,6 +41,7 @@ max_edges = 2000000 Choose the minimum context size. ''' min_context_size = 4 +max_context_size = 20 ''' Choose filters for building the graph. -- GitLab