Add test for line-by-line

This commit is contained in:
Filip Gralinski 2020-08-08 14:38:21 +02:00
parent a26b7b5a25
commit a08ae0cf99
4 changed files with 44 additions and 0 deletions

View File

@ -364,6 +364,38 @@ main = hspec $ do
runGEvalTest "f1-with-preprocessing" `shouldReturnAlmost` 0.57142857142857
it "Regexp substition" $ do
runGEvalTest "accuracy-with-flags" `shouldReturnAlmost` 0.8
it "In line-by-line mode" $ do
let sampleChallenge = GEvalSpecification
{ gesOutDirectory = "test/accuracy-flags-line-by-line/accuracy-flags-line-by-line-solution",
gesExpectedDirectory = Just "test/accuracy-flags-line-by-line/accuracy-flags-line-by-line",
gesTestName = "test-A",
gesSelector = Nothing,
gesOutFile = "out.tsv",
gesAltOutFiles = Nothing,
gesExpectedFile = "expected.tsv",
gesInputFile = "in.tsv",
gesMetrics = [read "Accuracy:f<in[1]:foo>s<\\d+><>"],
gesFormatting = FormattingOptions Nothing False,
gesTokenizer = Just Minimalistic,
gesGonitoHost = Nothing,
gesToken = Nothing,
gesGonitoGitAnnexRemote = Nothing,
gesReferences = Nothing,
gesBootstrapResampling = Nothing,
gesInHeader = Nothing,
gesOutHeader = Nothing }
results <- runLineByLineGeneralized KeepTheOriginalOrder sampleChallenge (const Data.Conduit.List.consume)
results `shouldBe` [
LineRecord "foo"
"Ala 123 ma kota."
"Ala ma 2 kota ."
1
1.0,
LineRecord "foo"
"Foo bar baz"
"Fox bax 456 bax"
2
0.0]
describe "Flag examples" $ do
it "none" $ do
runGEvalTest "flags-none" `shouldReturnAlmost` 0.2

View File

@ -0,0 +1,4 @@
Ala ma 2 kota .
computer
Fox bax 456 bax
nothing
1 Ala ma 2 kota .
2 computer
3 Fox bax 456 bax
4 nothing

View File

@ -0,0 +1,4 @@
Ala 123 ma kota.
computer
Foo bar baz
nothing
1 Ala 123 ma kota.
2 computer
3 Foo bar baz
4 nothing

View File

@ -0,0 +1,4 @@
foo
bar
foo
baz
1 foo
2 bar
3 foo
4 baz