diff --git a/src/GEval/Core.hs b/src/GEval/Core.hs index f7e8b04..e5ff9b1 100644 --- a/src/GEval/Core.hs +++ b/src/GEval/Core.hs @@ -40,6 +40,7 @@ module GEval.Core checkMultipleOuts, checkMultipleOutsCore, gesMainMetric, + gesMainScheme, gesPreprocess, getDataDecoder, threeLineSource, @@ -177,6 +178,11 @@ gesMainMetric spec = case gesMetrics spec of (scheme:_) -> evaluationSchemeMetric scheme otherwise -> error "no metric given" +gesMainScheme :: GEvalSpecification -> EvaluationScheme +gesMainScheme spec = case gesMetrics spec of + (scheme:_) -> scheme + otherwise -> error "no metric given" + gesPreprocess :: GEvalSpecification -> (Text -> Text) gesPreprocess spec = tokenizeTabSeparatedWithSpaces (gesTokenizer spec) diff --git a/src/GEval/LineByLine.hs b/src/GEval/LineByLine.hs index 41c9283..549de1e 100644 --- a/src/GEval/LineByLine.hs +++ b/src/GEval/LineByLine.hs @@ -23,6 +23,7 @@ module GEval.LineByLine import GEval.Core import GEval.Common +import GEval.EvaluationScheme import Text.Tokenizer import Data.Conduit.AutoDecompress (doNothing) @@ -359,8 +360,9 @@ runLineByLineGeneralized ordering spec consum = do (inputFilePath, expectedFilePath, outFilePath) <- checkAndGetFilesSingleOut True spec gevalLineByLineCore metric mSelector preprocess inputFilePath expectedFilePath outFilePath (sorter ordering .| consum mReferences) where metric = gesMainMetric spec + scheme = gesMainScheme spec mSelector = gesSelector spec - preprocess = gesPreprocess spec + preprocess = (gesPreprocess spec) . (applyPreprocessingOperations scheme) sorter KeepTheOriginalOrder = doNothing sorter ordering = gobbleAndDo $ sortBy (sortOrder ordering (getMetricOrdering metric)) sortOrder FirstTheWorst TheHigherTheBetter = compareScores @@ -414,7 +416,8 @@ runMultiOutputGeneralized spec consum = do runResourceT $ runConduit $ (sequenceSources sources .| consum) where metric = gesMainMetric spec - preprocess = gesPreprocess spec + scheme = gesMainScheme spec + preprocess = (gesPreprocess spec) . (applyPreprocessingOperations scheme) mSelector = gesSelector spec runMostWorseningFeatures :: ResultOrdering -> FilePath -> GEvalSpecification -> BlackBoxDebuggingOptions -> IO ()