Skip to content
Snippets Groups Projects
Commit 083a9d89 authored by Charlotte Mauvezin's avatar Charlotte Mauvezin
Browse files

Correctif Chaza

parent 1eed43c8
No related branches found
No related tags found
1 merge request!10Multiple input
Pipeline #103824 passed
......@@ -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__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment