Fix bug with preprocessing ops not handled in --line-by-line mode

This commit is contained in:
Filip Gralinski 2019-12-16 12:47:35 +01:00
parent 9a3a28a813
commit ad30bb9384
2 changed files with 11 additions and 2 deletions

View File

@ -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)

View File

@ -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 ()