diff --git a/nerval/evaluate.py b/nerval/evaluate.py index 62e6b881375c22785c37ae580ed02923a8ea8ef0..e05d6a1705d1ff3ab31a4e61268ca9202da64f74 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 253c14d5f8bbe7565952ba97ccfb5139ef9d7838..65aefd79338264ed79d3c42040fe0314fae385a0 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], )