From 1e4bda4f63182e7aa0e95b66a36e9b3ed53e8c09 Mon Sep 17 00:00:00 2001 From: "Vriezen, E.C. (Emma)" <e.vriezen@student.ru.nl> Date: Mon, 16 Dec 2019 21:22:56 +0100 Subject: [PATCH] Addex the .index function to Sentence. This fixes some output problems of the program. --- umbra/mistake_finder.py | 2 ++ umbra/words.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/umbra/mistake_finder.py b/umbra/mistake_finder.py index 8587e1bd..61652635 100644 --- a/umbra/mistake_finder.py +++ b/umbra/mistake_finder.py @@ -30,6 +30,8 @@ class MistakeFinder: # Loop over the shadow: for index, word in enumerate(self._shadow): if not word.correct and word.mistake is None: + if word.word == "geen": + print("boo") self._determine_mistake(index, word) # Loop over the source: for word in self._source: diff --git a/umbra/words.py b/umbra/words.py index f65e5d7d..6629ddb4 100644 --- a/umbra/words.py +++ b/umbra/words.py @@ -242,6 +242,12 @@ class Sentence(list): def __init__(self, words): super().__init__(words) + def index(self, word): + for index in range(0, len(self)): + if self[index].onset == word.onset: + return index + return -1 + def find_previous_anchor(self, index): """Find the index of the last anchor before specified index. -- GitLab