diff --git a/umbra/anchor_algorithm.py b/umbra/anchor_algorithm.py index d0d31ff22a9fd821df9a661733b446df37adc424..7ea4402342924d28cdb71b2d59fa83e8e5a24316 100644 --- a/umbra/anchor_algorithm.py +++ b/umbra/anchor_algorithm.py @@ -82,6 +82,7 @@ class AnchorAlgorithm(AlignmentStrategy): found = True competing_over = None src_word.shadowed = True + src_word.shadow = shd_word shd_word.correct = True shd_word.source = src_word else: # If potential shadow is already flagged, store it @@ -89,6 +90,7 @@ class AnchorAlgorithm(AlignmentStrategy): # If true, then competing_over was wrongly flagged as correct: if competing_over is not None: competing_over.source.shadowed = False + competing_over.source.shadow = None competing_over.source = src_word # Shadow to new source word src_word.shadowed = True diff --git a/umbra/statistics.py b/umbra/statistics.py index 1fe76449d452f96b5aa9d9a14f278515b7bd587d..a71f036b9fc7e7bd0ecdf9da983f04bdc250e998 100644 --- a/umbra/statistics.py +++ b/umbra/statistics.py @@ -85,11 +85,8 @@ class Statistics: # Now the results are from the Anchor algorithm analysis. trial.results = self._mistake_counter.calculate_accuracy(source_em, shadow_em) - - #IMPORTANT: This will not work on source_em because the matching is - # the other way around. delays_per_word = [] - for source_word in source: + for source_word in source_em: if source_word.has_shadow(): delays_per_word.append([trial.participant, trial.condition, trial.video, source_word.word, diff --git a/umbra/words.py b/umbra/words.py index 2801d8b87326a6b532fc2957115ec3c3c6837e7c..f65e5d7dff38a06969c70bb3c3246446e5fec2fe 100644 --- a/umbra/words.py +++ b/umbra/words.py @@ -201,6 +201,7 @@ class SourceWord(Word): def _set_anchor(self, anchor): self._anchor = anchor + self._shadow = anchor @property def shadow(self): @@ -236,6 +237,7 @@ class SourceWord(Word): """ return other.onset - self._onset + class Sentence(list): def __init__(self, words): super().__init__(words)