Skip to content

Feature/basic score - #14

Open
laurejt wants to merge 9 commits into
developfrom
feature/basic-score
Open

laurejt wants to merge 9 commits into
developfrom
feature/basic-score

Conversation

@laurejt

@laurejt laurejt commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Associated Issue(s): resolves #10, #11, #12, #13

Changes in this PR

Include all key changes in this pull request

  • Moves span methods to spans/match to span_utils
  • Moves custom span-level function types to span_utils
  • Removes ignore_label functionality from span utility methods
  • Adds a custom composite match score (uses both label and boundary scoring)
  • Add methods for computing evaluation metrics for individual SpanAlignments (eval)
  • Add a meta-function construct_aligner for building a span alignment method
  • Update DocSpans so they are hashable (by converting internal _spans field to a tuple)
  • Two test JSONL files ref.jsonl and sys.jsonl to make local testing easier (tests/test_data)
  • Add compute_metrics script for computing document- and entity-level evaluation metrics (precision, recall, F1) for two span annotations JSONL files.

Notes

  • Apologies in advance for the very large PR
  • I've used meta-functions to help simplify computing aggregated evaluation metrics. Both of these are used to set the optional parameters that should be fixed during evaluation.
  • With this PR, does spanerr look ready for an alpha release?

Notes for Testing

Case 1. Entity-level metrics with "select_first" alignment & "overlap_factor" scoring

Command:

uv run python src/spanerr/compute_metrics.py tests/test_data/ref.jsonl tests/test_data/sys.jsonl entity select_first overlap_factor

Final Output

Macro entity-level metrics for 9 documents:
- Precision = 0.348
- Recall = 0.3797
- F1 = 0.3631

Case 2. Document-level metrics with "corppa" alignment & "jaccard" scoring

Command:

uv run python src/spanerr/compute_metrics.py tests/test_data/ref.jsonl tests/test_data/sys.jsonl document corppa jaccard

Final Output

Macro document-level metrics for 9 documents:
- Precision = 0.4276
- Recall = 0.4649
- F1 = 0.43

Reviewer Checklist

  • Can successfully run compute_metrics script locally with expected output (see Notes for Testing)
  • Output to command line looks reasonable
  • Changelog is legible and sufficient

@laurejt
laurejt requested a review from rlskoeser September 15, 2026 21:11
@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.78788% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.30%. Comparing base (d005215) to head (9c79dc6).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #14      +/-   ##
===========================================
- Coverage   100.00%   99.30%   -0.70%     
===========================================
  Files            7       11       +4     
  Lines          545     1159     +614     
  Branches        36       77      +41     
===========================================
+ Hits           545     1151     +606     
- Misses           0        4       +4     
- Partials         0        4       +4     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant