underscores can be used in the BIO format

This commit is contained in:
Filip Gralinski 2018-05-29 20:59:00 +02:00
parent 3f7384f467
commit 65e8d2562e
5 changed files with 10 additions and 1 deletions

View File

@ -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 "/"

View File

@ -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

View File

@ -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
1 O O B_city/POZNAŃ O O B_date/MARCH I_date/12
2 B_city/BUK O O O
3 B_name/FOO O B_surname/KOWALSKI

View File

@ -0,0 +1 @@
--metric BIO-F1

View File

@ -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
1 O O B_city/POZNAŃ O O B_date/MARCH I_date/12
2 O O O O
3 O B_city/KONIN O