Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ner/nerval
1 result
Show changes
Commits on Source (2)
......@@ -2,8 +2,10 @@ from prettytable import MARKDOWN, PrettyTable
from nerval import ALL_ENTITIES
TABLE_HEADER = ["tag", "predicted", "matched", "Precision", "Recall", "F1", "Support"]
def print_markdown_table(header: list[str], rows: list[list]) -> None:
def print_markdown_table(header: list[str], rows: list[list]) -> list[list]:
"""Prints a Markdown table filled with the provided header and rows."""
table = PrettyTable()
table.field_names = header
......@@ -26,8 +28,10 @@ def print_markdown_table(header: list[str], rows: list[list]) -> None:
table.add_rows(rows)
print(table)
return rows
def print_results(scores: dict) -> None:
def print_results(scores: dict) -> list[list]:
"""Display final results.
None values are kept to indicate the absence of a certain tag in either annotation or prediction.
......@@ -50,13 +54,10 @@ def print_results(scores: dict) -> None:
],
)
print_markdown_table(
["tag", "predicted", "matched", "Precision", "Recall", "F1", "Support"],
results,
)
return print_markdown_table(TABLE_HEADER, results)
def print_result_compact(scores: dict) -> None:
def print_result_compact(scores: dict) -> list[list]:
result = [
ALL_ENTITIES,
scores[ALL_ENTITIES]["predicted"],
......@@ -66,7 +67,5 @@ def print_result_compact(scores: dict) -> None:
round(scores[ALL_ENTITIES]["F1"], 3),
scores[ALL_ENTITIES]["Support"],
]
print_markdown_table(
["tag", "predicted", "matched", "Precision", "Recall", "F1", "Support"],
[result],
)
return print_markdown_table(TABLE_HEADER, [result])
......@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "teklia-nerval"
version = "0.3.3rc2"
version = "0.3.3rc3"
description = "Tool to evaluate NER on noisy text."
dynamic = ["dependencies"]
authors = [
......