more tests for GLEU

This commit is contained in:
Filip Gralinski 2018-09-12 20:37:44 +02:00
parent 5cff29cf06
commit 9b77f08876
7 changed files with 25 additions and 0 deletions

View File

@ -84,6 +84,10 @@ main = hspec $ do
describe "GLEU" $ do
it "simple example" $
runGEvalTest "gleu-simple" `shouldReturnAlmost` 0.462962962962963
it "empty translation" $
runGEvalTest "gleu-empty" `shouldReturnAlmost` 0.0
it "perfect translation" $
runGEvalTest "gleu-perfect" `shouldReturnAlmost` 1.0
describe "Accuracy" $ do
it "simple example" $
runGEvalTest "accuracy-simple" `shouldReturnAlmost` 0.6
@ -477,6 +481,11 @@ testMatchFun _ _ = False
extractVal :: (Either (ParserResult GEvalOptions) (Maybe [(SourceSpec, [MetricValue])])) -> IO MetricValue
extractVal (Right (Just ([(_, val:_)]))) = return val
extractVal (Right Nothing) = return $ error "no metrics???"
extractVal (Right (Just [])) = return $ error "emtpy metric list???"
extractVal (Left result) = do
handleParseResult result
return $ error "something wrong"
runGEvalTest = runGEvalTestExtraOptions []

View File

@ -0,0 +1,3 @@

View File

@ -0,0 +1 @@
--metric GLEU

View File

@ -0,0 +1,3 @@
Alica has a cat
It is a tree
Yes
1 Alica has a cat
2 It is a tree
3 Yes

View File

@ -0,0 +1,4 @@
I have an idea .
It is cold .
Yes
No
1 I have an idea .
2 It is cold .
3 Yes
4 No

View File

@ -0,0 +1 @@
--metric GLEU

View File

@ -0,0 +1,4 @@
I have an idea .
It is cold .
Yes
No
1 I have an idea .
2 It is cold .
3 Yes
4 No