Skip to content

Commit

Permalink
check collected values
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneBinder committed Nov 8, 2024
1 parent 6a05f28 commit 37756fa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/metrics/test_span_length_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def test_documents(documents):
def test_span_length_collector(documents):
statistic = SpanLengthCollector(layer="entities")
values = statistic(documents)
assert statistic._values == [[8, 1, 2, 1], [10, 4, 8]]
assert values == {
"len": 7,
"max": 10,
Expand All @@ -62,6 +63,10 @@ def test_span_length_collector(documents):

statistic = SpanLengthCollector(layer="entities", labels="INFERRED")
values = statistic(documents)
assert [dict(v) for v in statistic._values] == [
{"per": [8, 2], "org": [1, 1]},
{"per": [10], "org": [4, 8]},
]
assert values == {
"org": {"len": 4, "max": 8, "mean": 3.5, "min": 1, "std": 2.8722813232690143},
"per": {"len": 3, "max": 10, "mean": 6.666666666666667, "min": 2, "std": 3.39934634239519},
Expand Down

0 comments on commit 37756fa

Please sign in to comment.