diff --git a/src/GEval/BIO.hs b/src/GEval/BIO.hs index f213ab4..7b7b601 100644 --- a/src/GEval/BIO.hs +++ b/src/GEval/BIO.hs @@ -93,7 +93,7 @@ bioLabelParser = (string "O" *> pure Outside) <|> (do labelType <- bioMarkerParser - string "-" + (string "-" <|> string "_") label <- takeWhile1 (\c -> not (isSpace c) && c /= '/') normalized <- (do string "/" diff --git a/test/Spec.hs b/test/Spec.hs index b8dac23..83572e6 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -259,6 +259,8 @@ main = hspec $ do runGEvalTest "bio-f1-complex" `shouldReturnAlmost` 0.625 it "calculate F1" $ do runGEvalTest "bio-f1-simple" `shouldReturnAlmost` 0.5 + it "calculate F1 with underscores rather than minus signs" $ do + runGEvalTest "bio-f1-simple-underscores" `shouldReturnAlmost` 0.5 it "check perfect score" $ do runGEvalTest "bio-f1-perfect" `shouldReturnAlmost` 1.0 it "check inconsistent input" $ do diff --git a/test/bio-f1-simple-underscores/bio-f1-simple-underscores-solution/test-A/out.tsv b/test/bio-f1-simple-underscores/bio-f1-simple-underscores-solution/test-A/out.tsv new file mode 100644 index 0000000..4380412 --- /dev/null +++ b/test/bio-f1-simple-underscores/bio-f1-simple-underscores-solution/test-A/out.tsv @@ -0,0 +1,3 @@ +O O B_city/POZNAŃ O O B_date/MARCH I_date/12 +B_city/BUK O O O +B_name/FOO O B_surname/KOWALSKI diff --git a/test/bio-f1-simple-underscores/bio-f1-simple-underscores/config.txt b/test/bio-f1-simple-underscores/bio-f1-simple-underscores/config.txt new file mode 100644 index 0000000..70977e1 --- /dev/null +++ b/test/bio-f1-simple-underscores/bio-f1-simple-underscores/config.txt @@ -0,0 +1 @@ +--metric BIO-F1 diff --git a/test/bio-f1-simple-underscores/bio-f1-simple-underscores/test-A/expected.tsv b/test/bio-f1-simple-underscores/bio-f1-simple-underscores/test-A/expected.tsv new file mode 100644 index 0000000..31de6dc --- /dev/null +++ b/test/bio-f1-simple-underscores/bio-f1-simple-underscores/test-A/expected.tsv @@ -0,0 +1,3 @@ +O O B_city/POZNAŃ O O B_date/MARCH I_date/12 +O O O O +O B_city/KONIN O