Skip to content
Snippets Groups Projects
Commit d05623a8 authored by Haak, R. (Romeo)'s avatar Haak, R. (Romeo)
Browse files

Merged master into wrapper and resolved all conflicts that were present

parent 1a372572
No related branches found
No related tags found
1 merge request!82Sc 129/wrapper
......@@ -3,14 +3,13 @@ from alignment_strategy import AlignmentStrategy
from words import Sentence
import numpy as np
from mistake_enum import Mistake
from dutch_mmetaphone import DutchPhonetics
class NeedlemanWunsch(AlignmentStrategy):
"""Class that aligns the words of a shadow and source file according
to the Needleman-Wunsch algorithm"""
def __init__(self, seman_checker, form_checker):
def __init__(self, seman_checker, form_checker, phon_checker):
super().__init__()
self._match = 4
self._mismatch = -2
......@@ -25,10 +24,11 @@ class NeedlemanWunsch(AlignmentStrategy):
self._matrix = None
self._seman_checker = seman_checker
self._form_checker = form_checker
self._phon_checker = phon_checker
def alignment_options(self, match=None, mismatch=None,
gap_sc=None, seman_match=None, repetition=None,
form_match=None):
gap_sc=None, seman_match=None, phon_match=None,
repetition=None, form_match=None):
""" Set the scores that are allocated whilst aligning. Can be changed
one at a time or more at once.
......@@ -115,7 +115,7 @@ class NeedlemanWunsch(AlignmentStrategy):
elif self._seman_checker.semantically_related(
source_word.word, shadow_word.word):
value = self._seman_match
elif DutchPhonetics.compare(source_word.word,
elif self._phon_checker.compare(source_word.word,
shadow_word.word):
value = self._phon_match
else:
......@@ -212,7 +212,7 @@ class NeedlemanWunsch(AlignmentStrategy):
source.shadow = shadow
source.mistake = Mistake.FORM
shadow.mistake = Mistake.FORM
elif DutchPhonetics.compare(source.word, shadow.word):
elif self._phon_checker.compare(source.word, shadow.word):
source.shadowed = True
source.mistake = Mistake.PHONETIC
shadow.mistake = Mistake.PHONETIC
......
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