From 02d0ec015424aef0e85ff89363b464fbf75985f5 Mon Sep 17 00:00:00 2001 From: "Verbeek, J.M. (Janneke)" <j.verbeek@student.ru.nl> Date: Wed, 4 Dec 2019 16:58:06 +0100 Subject: [PATCH] Fixed the error, turned out I'd been reading two shadow files and comparing those --- umbra/controller.py | 33 +++++++++++++++++++-------------- umbra/mistake_finder.py | 1 - umbra/model.py | 4 +++- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/umbra/controller.py b/umbra/controller.py index dd629561..c2c3ce46 100644 --- a/umbra/controller.py +++ b/umbra/controller.py @@ -173,17 +173,22 @@ class Controller: Extensible to consider "type". Now assume shadow files. """ - for file_path in self._shadow_files: - if "AO" not in file_path or ".csv" not in file_path: - # Very dirty - pass # TODO: raise error - elif type == "shadow": - dict = self._model.get_multi_data(type) - key = ut.shadow_regex(file_path) - data = self._filereader.read(file_path, type) - ut.add_to_dict(key, data, dict, alternative=True) - else: - dict = self._model.get_multi_data(type) - key = ut.id_regex(file_path) - data = self._filereader.read(file_path, type) - ut.add_to_dict(key, data, dict, alternative=True) + if type == "shadow": + for file_path in self._shadow_files: + if "AO" not in file_path or ".csv" not in file_path: + # Very dirty + pass # TODO: raise error + elif type == "shadow": + dict = self._model.get_multi_data(type) + key = ut.shadow_regex(file_path) + data = self._filereader.read(file_path, type) + ut.add_to_dict(key, data, dict, alternative=True) + else: + for file_path in self._source_files: + if ".csv" not in file_path: + pass + else: + dict = self._model.get_multi_data(type) + key = ut.id_regex(file_path) + data = self._filereader.read(file_path, type) + ut.add_to_dict(key, data, dict, alternative=True) diff --git a/umbra/mistake_finder.py b/umbra/mistake_finder.py index fb188350..de514d2a 100644 --- a/umbra/mistake_finder.py +++ b/umbra/mistake_finder.py @@ -134,7 +134,6 @@ class MistakeFinder: while chain and index-i > 1: diff += 1 i += 1 - print(i, index) chain = self._shadow[i].word == self._shadow[index+diff].word if chain: diff --git a/umbra/model.py b/umbra/model.py index 02807ba7..fa81fdf0 100644 --- a/umbra/model.py +++ b/umbra/model.py @@ -133,11 +133,13 @@ class Model: for key, source in self._multi_data_source.items(): for key2, shadow in self._multi_data_shadow.items(): + if key == ut.filter_key(key2): + print([str(s) for s in source]) + print([str(s) for s in shadow]) result = self._stats.analyze(source, shadow) ut.add_to_dict(key+"_res", result, self._multi_results) - self._stats = Statistics(None) else: pass -- GitLab