diff --git a/umbra/anchor_algorithm.py b/umbra/anchor_algorithm.py index 14c8d314cad139b8bd64b98d2403056e13c187c1..2c2c0c980f903d82143d1fac94dc01dee119849c 100644 --- a/umbra/anchor_algorithm.py +++ b/umbra/anchor_algorithm.py @@ -52,8 +52,7 @@ class AnchorAlgorithm(AlignmentStrategy): for src_index in range(src_start, src_end): src_word = self._source[src_index] if not src_word.is_anchor(): - self._search_word_in_interval(src_word, shd_start, shd_end, - source, shadow) + self._search_word_in_interval(src_word, shd_start, shd_end) else: # If src_word is an anchor, only search in shadow after it: shd_start = self._shadow.index(src_word.anchor()) diff --git a/umbra/controller.py b/umbra/controller.py index dfaded878f0ef46ed1747e34a2f3650cf6a9f339..942c83da85499b4ca4e842d5f2fc7ad17b4f6770 100644 --- a/umbra/controller.py +++ b/umbra/controller.py @@ -126,5 +126,6 @@ class Controller: data = self._filereader.read() if type == "source": self._model._data_source = data + self._model._id = ut.id_regex(path) else: self._model._data_shadow = data diff --git a/umbra/model.py b/umbra/model.py index 0fec6e7ca0c5bbf9bde91664f8ccc8a4b67e71af..ab1705a363de77cc5974e7aa9b06b492f8c3e76b 100644 --- a/umbra/model.py +++ b/umbra/model.py @@ -11,6 +11,7 @@ class Model: self._analysis_results = None self._multi_results = {} self._save_pref = None + self._id = -1 @property def save_pref(self): @@ -67,11 +68,12 @@ class Model: print(self._multi_data_shadow, self.has_shadow()) if self._multi_data_shadow: for key, data in self._multi_data_shadow.items(): - # TODO: if same number then do this - result = self._stats.analyze(self._data_source, data) - self.add_to_dict(key+"_res", result, self._multi_results) - - # else pass + if self._id in key: + result = self._stats.analyze(self._data_source, data) + self.add_to_dict(key+"_res", result, self._multi_results) + else: + print("passed") + pass else: self._analysis_results = \ self._stats.analyze(self._data_source, self._data_shadow) diff --git a/umbra/utils.py b/umbra/utils.py index 964a17947b7d2cdf4a66ea5c39ec5759692f8a2f..4d169ab1b5de3dbda653a536bc3332176e22865d 100644 --- a/umbra/utils.py +++ b/umbra/utils.py @@ -40,3 +40,10 @@ class Utils: match = re.search("AO\d", path) if match: return match.group() + + def id_regex(path): + match = re.search("\d\.TextGrid", path) + # Make sure that not different number accidentally + if match: + return match.group()[0] +