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

Revised the analyze method as all of the information could now be retrieved from the wrapper class.

parent b417306d
No related branches found
No related tags found
1 merge request!82Sc 129/wrapper
......@@ -4,6 +4,7 @@ from anchor_algorithm import AnchorAlgorithm
from mistake_finder import MistakeFinder
from semantic_checker import SemanticChecker
from form_checker import FormChecker
from mistake_counter import MistakeCounter
from utils import Utils as ut
import time
......@@ -24,6 +25,7 @@ class Statistics:
self._seman_checker = SemanticChecker()
self._form_checker = FormChecker()
self._mistake_finder = MistakeFinder(self._seman_checker)
self._mistake_counter = MistakeCounter()
@property
def strategy(self):
......@@ -33,15 +35,19 @@ class Statistics:
def strategy(self, strategy):
self._strategy = strategy
def analyze(self, source, shadow):
def analyze(self, trial):
"""Perform the necessary analyses.
Currently uses all strategies for testing purposes.
Should only use the specified strategy upon release.
Args:
source: the words in the source file
shadow: the words in the shadow file
trial: the trial to analyze
Returns:
correctness
"""
source = trial.source
shadow = trial.shadow
# Make a deepcopy such that the testing is equal for both strategies:
source_em = copy.deepcopy(source)
......@@ -77,4 +83,8 @@ class Statistics:
discrete_time = time.time() - discrete_start_time
results += f'taken time:{discrete_time}\n'
# Now the results are from the Anchor algorithm analysis.
trial.results = self._mistake_counter.\
calculate_accuracy(source_em, shadow_em)
return correctness
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