Do not preprocess outputs for some metrics
This commit is contained in:
parent
ad5d614f48
commit
af21031172
@ -230,6 +230,16 @@ isInputNeeded :: Metric -> Bool
|
|||||||
isInputNeeded CharMatch = True
|
isInputNeeded CharMatch = True
|
||||||
isInputNeeded _ = False
|
isInputNeeded _ = False
|
||||||
|
|
||||||
|
-- | Could output be preprocessable
|
||||||
|
isPreprocessable :: Metric -> Bool
|
||||||
|
isPreprocessable BLEU = True
|
||||||
|
isPreprocessable GLEU = True
|
||||||
|
isPreprocessable WER = True
|
||||||
|
isPreprocessable Accuracy = True
|
||||||
|
isPreprocessable CharMatch = True
|
||||||
|
isPreprocessable TokenAccuracy = True
|
||||||
|
isPreprocessable _ = False
|
||||||
|
|
||||||
defaultOutDirectory = "."
|
defaultOutDirectory = "."
|
||||||
defaultTestName = "test-A"
|
defaultTestName = "test-A"
|
||||||
defaultOutFile = "out.tsv"
|
defaultOutFile = "out.tsv"
|
||||||
@ -454,8 +464,11 @@ fileAsLineSource spec preprocess =
|
|||||||
gevalCoreOnSingleLines :: Metric -> (Text -> Text) -> LineInFile -> LineInFile -> LineInFile -> IO (MetricValue)
|
gevalCoreOnSingleLines :: Metric -> (Text -> Text) -> LineInFile -> LineInFile -> LineInFile -> IO (MetricValue)
|
||||||
gevalCoreOnSingleLines metric preprocess inpLine expLine outLine =
|
gevalCoreOnSingleLines metric preprocess inpLine expLine outLine =
|
||||||
gevalCoreOnSources metric (singleLineAsLineSource inpLine preprocess)
|
gevalCoreOnSources metric (singleLineAsLineSource inpLine preprocess)
|
||||||
(singleLineAsLineSource expLine preprocess)
|
(singleLineAsLineSource expLine outputPreprocess)
|
||||||
(singleLineAsLineSource outLine preprocess)
|
(singleLineAsLineSource outLine outputPreprocess)
|
||||||
|
where outputPreprocess = if isPreprocessable metric
|
||||||
|
then preprocess
|
||||||
|
else id
|
||||||
|
|
||||||
singleLineAsLineSource :: LineInFile -> (Text -> Text) -> LineSource (ResourceT IO)
|
singleLineAsLineSource :: LineInFile -> (Text -> Text) -> LineSource (ResourceT IO)
|
||||||
singleLineAsLineSource (LineInFile sourceSpec lineNo line) preprocess =
|
singleLineAsLineSource (LineInFile sourceSpec lineNo line) preprocess =
|
||||||
|
Loading…
Reference in New Issue
Block a user