Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nerval
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Named Entity Recognition
nerval
Commits
083a9d89
Commit
083a9d89
authored
3 years ago
by
Charlotte Mauvezin
Browse files
Options
Downloads
Patches
Plain Diff
Correctif Chaza
parent
1eed43c8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!10
Multiple input
Pipeline
#103824
passed
3 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nerval/evaluate.py
+24
-11
24 additions, 11 deletions
nerval/evaluate.py
with
24 additions
and
11 deletions
nerval/evaluate.py
+
24
−
11
View file @
083a9d89
...
...
@@ -568,7 +568,7 @@ def run_multiple(file_csv, folder, threshold):
else
:
raise
f
"
No file found for files
{
annot
}
,
{
predict
}
"
else
:
raise
"
This is no
folder
"
raise
Exception
(
"
the path indicated does not lead to a
folder
.
"
)
def
threshold_float_type
(
arg
):
...
...
@@ -588,23 +588,27 @@ def main():
logging
.
basicConfig
(
level
=
logging
.
INFO
)
parser
=
argparse
.
ArgumentParser
(
description
=
"
Compute score of NER on predict.
"
)
parser
.
add_argument
(
"
-m
"
,
"
--multiple
"
,
help
=
"
Single if 1, multiple 2
"
,
type
=
int
,
required
=
True
,
)
parser
.
add_argument
(
"
-a
"
,
"
--annot
"
,
help
=
"
Annotation in BIO format.
"
,
required
=
False
,
)
parser
.
add_argument
(
"
-p
"
,
"
--predict
"
,
help
=
"
Prediction in BIO format.
"
,
required
=
False
,
)
parser
.
add_argument
(
"
-t
"
,
"
--threshold
"
,
help
=
"
Set a distance threshold for the match between gold and predicted entity.
"
,
required
=
False
,
default
=
THRESHOLD
,
type
=
threshold_float_type
,
)
...
...
@@ -612,24 +616,33 @@ def main():
"
-c
"
,
"
--csv
"
,
help
=
"
Csv with the correlation between the annotation bio files and the predict bio files
"
,
required
=
False
,
type
=
Path
,
)
parser
.
add_argument
(
"
-f
"
,
"
--folder
"
,
help
=
"
Folder containing the bio files referred to in the csv file
"
,
required
=
False
,
type
=
Path
,
)
args
=
parser
.
parse_args
()
if
args
.
csv
and
args
.
folder
:
run_multiple
(
args
.
csv
,
args
.
folder
,
args
.
threshold
)
elif
args
.
annot
and
args
.
predict
:
run
(
args
.
annot
,
args
.
predict
,
args
.
threshold
)
if
args
.
multiple
==
1
or
args
.
multiple
==
2
:
if
args
.
multiple
==
2
:
if
not
args
.
folder
:
raise
argparse
.
ArgumentError
(
args
.
folder
,
"
-f must be given if -m is 2
"
)
if
not
args
.
csv
:
raise
argparse
.
ArgumentError
(
args
.
folder
,
"
-c must be given if -m is 2
"
)
if
args
.
folder
and
args
.
csv
:
run_multiple
(
args
.
csv
,
args
.
folder
,
args
.
threshold
)
if
args
.
multiple
==
1
:
if
not
args
.
annot
:
raise
argparse
.
ArgumentError
(
args
.
folder
,
"
-a must be given if -m is 1
"
)
if
not
args
.
predict
:
raise
argparse
.
ArgumentError
(
args
.
folder
,
"
-p must be given if -m is 1
"
)
if
args
.
annot
and
args
.
predict
:
run
(
args
.
annot
,
args
.
predict
,
args
.
threshold
)
else
:
raise
"
You did not give the proper input
"
raise
argparse
.
ArgumentTypeError
(
"
Value has to be 1 or 2
"
)
if
__name__
==
"
__main__
"
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment