Skip to content
Snippets Groups Projects
Commit 3bbc73a5 authored by Vriezen, E.C. (Emma)'s avatar Vriezen, E.C. (Emma)
Browse files

Shadow words are now also marked as a phonetic mistake if they are marked as such.

parent 982e1c29
No related branches found
No related tags found
1 merge request!80Sc 134/form mistake detection aa
......@@ -83,11 +83,12 @@ class MistakeFinder:
not phonetic_mistake and src_index < (
len(self._source) - 1): # Crude fix, but removes error
src_word = self._source[src_index]
if DutchPhonetics.compare(src_word.word, shd_word.word):
phonetic_mistake = self.phonetically_related(src_word, shd_word)
if phonetic_mistake:
shd_word.mistake = Mistake.PHONETIC
shd_word.source = src_word
if not src_word.shadowed and src_word.mistake is None:
src_word.mistake = Mistake.PHONETIC
phonetic_mistake = True
src_index += 1
return phonetic_mistake
......@@ -213,6 +214,22 @@ class MistakeFinder:
and shd_string != src_string
return related
def phonetically_related(self, src_word, shd_word):
"""Checks if src_word and shd_word are phonetically related.
Args:
src_word: SourceWord instance
shd_word: ShadowWord instance
Returns:
related: True if src_word and shd_word are phonetically related,
False if not.
"""
shd_string = shd_word.word
src_string = src_word.word
related = DutchPhonetics.compare(src_string, shd_string)\
and shd_string != src_string
return related
def form_related(self, src_word, shd_word):
"""Checks if src_word and shd_word are related in form.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment