Introduce Filter type

This commit is contained in:
Filip Gralinski 2020-05-13 08:13:31 +02:00
parent c1b65531b9
commit 6f6c96969d
2 changed files with 8 additions and 5 deletions

View File

@ -266,7 +266,7 @@ extensionsHandled = ["tsv", "jsonl"]
data LineSource m = LineSource (ConduitT () Text m ()) (Text -> ItemTarget) (Text -> Text) SourceSpec Word32
data LineSourcesSpecification m = LineSourcesSpecification {
lineSourcesFilter :: Maybe (Text -> Bool),
lineSourcesFilter :: Filter,
lineSourcesInputSource :: LineSource m,
lineSourcesExpectedSource :: LineSource m,
lineSourcesOutputSource :: LineSource m }
@ -377,7 +377,7 @@ checkAndGetDataSources forceInput gevalSpec = do
challengeDataSourceExpected = expectedSource,
challengeDataSourceSelector = mSelector,
challengeDataSourcePreprocess = preprocess,
challengeDataSourceFilter = Nothing,
challengeDataSourceFilter = Filter Nothing,
challengeDataSourceInHeader = mInHeader,
challengeDataSourceOutHeader = mOutHeader }
@ -502,7 +502,7 @@ gevalCoreOnSingleLines metric preprocess inpDecoder inpLine expDecoder expLine o
then preprocess
else id
lsSpec = LineSourcesSpecification {
lineSourcesFilter = Nothing,
lineSourcesFilter = Filter Nothing,
lineSourcesInputSource = singleLineAsLineSource inpLine inpDecoder preprocess,
lineSourcesExpectedSource = singleLineAsLineSource expLine expDecoder outputPreprocess,
lineSourcesOutputSource = singleLineAsLineSource outLine outDecoder outputPreprocess }

View File

@ -1,6 +1,7 @@
module GEval.DataSource
(ChallengeDataSource(..),
DataSource(..))
DataSource(..),
Filter(..))
where
import Data.Text
@ -9,6 +10,8 @@ import Data.Conduit.SmartSource
import Data.Conduit.Header
import GEval.Selector
newtype Filter = Filter (Maybe (Text -> Bool))
-- | This type specifies the way the challenge data (input and
-- expected data, but not outputs) flow into evaluation.
--
@ -18,7 +21,7 @@ data ChallengeDataSource = ChallengeDataSource {
challengeDataSourceExpected :: SourceSpec,
challengeDataSourceSelector :: Maybe Selector,
challengeDataSourcePreprocess :: Text -> Text,
challengeDataSourceFilter :: Maybe (Text -> Bool),
challengeDataSourceFilter :: Filter,
challengeDataSourceInHeader :: Maybe TabularHeader,
challengeDataSourceOutHeader :: Maybe TabularHeader }