From 014681cd925865f5735d08d00e9f1f63e1dfbf95 Mon Sep 17 00:00:00 2001 From: "Vriezen, E.C. (Emma)" <e.vriezen@student.ru.nl> Date: Sun, 1 Dec 2019 11:25:05 +0100 Subject: [PATCH] Fixed mistake assignment in words.py and made the code runnable (aka commented out some things in mistake_finder.py) --- umbra/mistake_finder.py | 6 ++++-- umbra/statistics.py | 4 ++-- umbra/words.py | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/umbra/mistake_finder.py b/umbra/mistake_finder.py index fe1f33a4..1c8bb932 100644 --- a/umbra/mistake_finder.py +++ b/umbra/mistake_finder.py @@ -25,13 +25,15 @@ class MistakeFinder: def _determine_mistake(self, index, word): if not self._check_repetition(word, index): # If not a repetition, - if not self._check_semantic_mistake(word): # semantic, - if not self._check_phonentic_mistake(word): # or phonetic, + #if not self._check_semantic_mistake(word): # semantic, + #if not self._check_phonentic_mistake(word): # or phonetic, # ... then shadow word is random: word.mistake = Mistake.RANDOM def _check_repetition(self, word, index): assert 0 <= index < len(self.shadow) + print(index) + # TODO: WordNet integration. Function below should be usable already! # def _check_semantic_mistake(self, shd_word): diff --git a/umbra/statistics.py b/umbra/statistics.py index 9e4727fb..3e72884d 100644 --- a/umbra/statistics.py +++ b/umbra/statistics.py @@ -53,8 +53,8 @@ class Statistics: print(f'source: {s_word.source} shadow: {s_word}') correctness = self._strategy.correctly_shadowed(source) # TODO: Make the mistake finding work with the statement below - # finder = MistakeFinder() - # finder.start(source_align_em, shadow_align_em) + finder = MistakeFinder() + finder.start(source_align_em, shadow_align_em) return source_align, shadow_align, correctness diff --git a/umbra/words.py b/umbra/words.py index 9a477d07..689fe325 100644 --- a/umbra/words.py +++ b/umbra/words.py @@ -162,7 +162,7 @@ class ShadowWord(Word): """ assert self._correct is False assert mistake != Mistake.SKIPPED - self._mistake(mistake) + self._mistake = mistake class SourceWord(Word): @@ -195,7 +195,7 @@ class SourceWord(Word): mistake: Mistake Enum """ assert mistake != Mistake.RANDOM - self._mistake(mistake) + self._mistake = mistake class Sentence(list): -- GitLab