Skip to content

Commit

Permalink
πŸ› dinglehopper-summarize: Handle reports without difference stats
Browse files Browse the repository at this point in the history
  • Loading branch information
mikegerber committed Oct 27, 2023
1 parent 39dc418 commit f077ce2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/dinglehopper/cli_summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ def process(reports_folder, occurrences_threshold=1):
cer_sum += cer
wer_sum += wer

for key, value in report_data["differences"]["character_level"].items():
diff_c[key] = diff_c.get(key, 0) + value
for key, value in report_data["differences"]["word_level"].items():
diff_w[key] = diff_w.get(key, 0) + value
try:
for key, value in report_data["differences"]["character_level"].items():
diff_c[key] = diff_c.get(key, 0) + value
for key, value in report_data["differences"]["word_level"].items():
diff_w[key] = diff_w.get(key, 0) + value
except KeyError:
pass

if len(cer_list) == 0:
click.echo(f"No reports found in folder '{os.path.abspath(reports_folder)}'")
Expand Down

0 comments on commit f077ce2

Please sign in to comment.