From 54076686e08acc05581d22bef1b0f8a132c8d7e7 Mon Sep 17 00:00:00 2001 From: EvaBardou <bardou@teklia.com> Date: Wed, 3 Jan 2024 17:30:35 +0100 Subject: [PATCH] Fix typo + Nits --- nerval/evaluate.py | 4 ++-- nerval/utils.py | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/nerval/evaluate.py b/nerval/evaluate.py index 62e6b88..e05d6a1 100644 --- a/nerval/evaluate.py +++ b/nerval/evaluate.py @@ -14,7 +14,7 @@ from nerval.parse import ( look_for_further_entity_part, parse_bio, ) -from nerval.utils import print_mardown_table, print_result_compact, print_results +from nerval.utils import print_markdown_table, print_result_compact, print_results logger = logging.getLogger(__name__) @@ -395,4 +395,4 @@ def run_multiple(file_csv: Path, folder: Path, threshold: int, verbose: bool): round(recall / count, 3), round(f1 / count, 3), ] - print_mardown_table(["Precision", "Recall", "F1"], [result]) + print_markdown_table(["Precision", "Recall", "F1"], [result]) diff --git a/nerval/utils.py b/nerval/utils.py index 253c14d..65aefd7 100644 --- a/nerval/utils.py +++ b/nerval/utils.py @@ -1,7 +1,8 @@ from prettytable import MARKDOWN, PrettyTable -def print_mardown_table(header: list[str], rows: list[list]): +def print_markdown_table(header: list[str], rows: list[list]) -> None: + """Prints a Markdown table filled with the provided header and rows.""" table = PrettyTable() table.field_names = header table.set_style(MARKDOWN) @@ -9,7 +10,7 @@ def print_mardown_table(header: list[str], rows: list[list]): print(table) -def print_results(scores: dict): +def print_results(scores: dict) -> None: """Display final results. None values are kept to indicate the absence of a certain tag in either annotation or prediction. @@ -32,13 +33,13 @@ def print_results(scores: dict): ], ) - print_mardown_table( + print_markdown_table( ["tag", "predicted", "matched", "Precision", "Recall", "F1", "Support"], results, ) -def print_result_compact(scores: dict): +def print_result_compact(scores: dict) -> None: result = [ "All", scores["All"]["predicted"], @@ -48,7 +49,7 @@ def print_result_compact(scores: dict): round(scores["All"]["F1"], 3), scores["All"]["Support"], ] - print_mardown_table( + print_markdown_table( ["tag", "predicted", "matched", "Precision", "Recall", "F1", "Support"], [result], ) -- GitLab