precision is part of specification now

This commit is contained in:
Filip Gralinski 2018-01-25 09:11:04 +01:00 committed by Filip Gralinski
parent e7518a1141
commit 6cfefed0c1
3 changed files with 6 additions and 5 deletions

View File

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

View File

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

View File

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