diff --git a/app/Main.hs b/app/Main.hs index 455c3ea..f2047ff 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -18,7 +18,7 @@ main = do Right (_, Nothing) -> return () showTheResult :: GEvalOptions -> MetricValue -> IO () -showTheResult opts val = putStrLn $ formatTheResult (geoPrecision opts) val +showTheResult opts val = putStrLn $ formatTheResult (gesPrecision $ geoSpec opts) val formatTheResult :: Maybe Int -> MetricValue -> String formatTheResult Nothing = show diff --git a/src/GEval/Core.hs b/src/GEval/Core.hs index bff690c..0a43801 100644 --- a/src/GEval/Core.hs +++ b/src/GEval/Core.hs @@ -147,7 +147,8 @@ data GEvalSpecification = GEvalSpecification gesOutFile :: String, gesExpectedFile :: String, gesInputFile :: String, - gesMetric :: Metric } + gesMetric :: Metric, + gesPrecision :: Maybe Int} getExpectedDirectory :: GEvalSpecification -> FilePath getExpectedDirectory spec = fromMaybe outDirectory $ gesExpectedDirectory spec @@ -157,7 +158,6 @@ data GEvalSpecialCommand = Init | LineByLine data GEvalOptions = GEvalOptions { geoSpecialCommand :: Maybe GEvalSpecialCommand, - geoPrecision :: Maybe Int, geoSpec :: GEvalSpecification } @@ -206,7 +206,8 @@ defaultGEvalSpecification = GEvalSpecification { gesOutFile = defaultOutFile, gesExpectedFile = defaultExpectedFile, gesInputFile = defaultInputFile, - gesMetric = defaultMetric } + gesMetric = defaultMetric, + gesPrecision = Nothing} isEmptyFile :: FilePath -> IO (Bool) isEmptyFile path = do diff --git a/src/GEval/OptionsParser.hs b/src/GEval/OptionsParser.hs index b084f25..7aaa1de 100644 --- a/src/GEval/OptionsParser.hs +++ b/src/GEval/OptionsParser.hs @@ -34,7 +34,6 @@ optionsParser = GEvalOptions (flag' LineByLine ( long "line-by-line" <> help "Give scores for each line rather than the whole test set" ))) - <*> optional precisionArgParser <*> specParser precisionArgParser :: Parser Int @@ -80,6 +79,7 @@ specParser = GEvalSpecification <> metavar "INPUT" <> help "The name of the file with the input (applicable only for some metrics)" ) <*> metricReader + <*> optional precisionArgParser metricReader :: Parser Metric metricReader = option auto