-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add chart range output to
accuracy
When running the accuracy command, print a nicer header giving some basic info like: who is truth and who is merely annotator? How many charts are in their overlap and what are the ID ranges? This should give some peace of mind that the stats are covering what they should be covering. When passing in --save, we print the header to the console, but not the written file, which is still just a csv/json of the stats. Also: - If a project didn't specify labels, the docs say we use all found labels. And we were... but only when scoring the "all labels" line item. We didn't score each found label on its own line. Now that's been fixed and we do score each found label separately. - If an unknown annotator name is passed to the accuracy command, we now give a nice understandable error.
- Loading branch information
Showing
10 changed files
with
105 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
/.idea/ | ||
/dist/ | ||
/site/ | ||
__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""Helper methods for printing to the console.""" | ||
|
||
|
||
def pretty_note_range(notes: set[int]) -> str: | ||
""" | ||
Returns a pretty, human-readable string for a set of notes. | ||
If no notes, this returns an empty string. | ||
Example: | ||
pretty_note_range({1, 2, 3, 7, 9, 10}) | ||
-> "1–3, 7, 9–10" | ||
""" | ||
ranges = [] | ||
range_start = None | ||
prev_note = None | ||
|
||
def end_range() -> None: | ||
if prev_note is None: | ||
return | ||
if range_start == prev_note: | ||
ranges.append(str(prev_note)) | ||
else: | ||
ranges.append(f"{range_start}–{prev_note}") # en dash | ||
|
||
for note in sorted(notes): | ||
if prev_note is None or prev_note + 1 != note: | ||
end_range() | ||
range_start = note | ||
prev_note = note | ||
|
||
end_range() | ||
|
||
return ", ".join(ranges) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters