more tests for GLEU
This commit is contained in:
parent
5cff29cf06
commit
9b77f08876
@ -84,6 +84,10 @@ main = hspec $ do
|
|||||||
describe "GLEU" $ do
|
describe "GLEU" $ do
|
||||||
it "simple example" $
|
it "simple example" $
|
||||||
runGEvalTest "gleu-simple" `shouldReturnAlmost` 0.462962962962963
|
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
|
describe "Accuracy" $ do
|
||||||
it "simple example" $
|
it "simple example" $
|
||||||
runGEvalTest "accuracy-simple" `shouldReturnAlmost` 0.6
|
runGEvalTest "accuracy-simple" `shouldReturnAlmost` 0.6
|
||||||
@ -477,6 +481,11 @@ testMatchFun _ _ = False
|
|||||||
|
|
||||||
extractVal :: (Either (ParserResult GEvalOptions) (Maybe [(SourceSpec, [MetricValue])])) -> IO MetricValue
|
extractVal :: (Either (ParserResult GEvalOptions) (Maybe [(SourceSpec, [MetricValue])])) -> IO MetricValue
|
||||||
extractVal (Right (Just ([(_, val:_)]))) = return val
|
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 []
|
runGEvalTest = runGEvalTestExtraOptions []
|
||||||
|
|
||||||
|
3
test/gleu-empty/gleu-empty-solution/test-A/out.tsv
Normal file
3
test/gleu-empty/gleu-empty-solution/test-A/out.tsv
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
|
1
test/gleu-empty/gleu-empty/config.txt
Normal file
1
test/gleu-empty/gleu-empty/config.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
--metric GLEU
|
3
test/gleu-empty/gleu-empty/test-A/expected.tsv
Normal file
3
test/gleu-empty/gleu-empty/test-A/expected.tsv
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Alica has a cat
|
||||||
|
It is a tree
|
||||||
|
Yes
|
|
4
test/gleu-perfect/gleu-perfect-solution/test-A/out.tsv
Normal file
4
test/gleu-perfect/gleu-perfect-solution/test-A/out.tsv
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
I have an idea .
|
||||||
|
It is cold .
|
||||||
|
Yes
|
||||||
|
No
|
|
1
test/gleu-perfect/gleu-perfect/config.txt
Normal file
1
test/gleu-perfect/gleu-perfect/config.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
--metric GLEU
|
4
test/gleu-perfect/gleu-perfect/test-A/expected.tsv
Normal file
4
test/gleu-perfect/gleu-perfect/test-A/expected.tsv
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
I have an idea .
|
||||||
|
It is cold .
|
||||||
|
Yes
|
||||||
|
No
|
|
Loading…
Reference in New Issue
Block a user