From f153ef196849fc960c2208ab1af6977f98058630 Mon Sep 17 00:00:00 2001 From: Ben Lambert Date: Sun, 8 Oct 2017 01:56:48 -0400 Subject: [PATCH] Correct off-by-one error in printing threshold for printing confusions, and changed that default to 1. (#16) --- asr_evaluation/__main__.py | 4 ++-- asr_evaluation/asr_evaluation.py | 6 +++--- setup.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/asr_evaluation/__main__.py b/asr_evaluation/__main__.py index 9409b82..c8523dc 100644 --- a/asr_evaluation/__main__.py +++ b/asr_evaluation/__main__.py @@ -28,8 +28,8 @@ def get_parser(): parser.add_argument('-c', '--confusions', action='store_true', help='Print tables of which words were confused.') parser.add_argument('-p', '--print-wer-vs-length', action='store_true', help='Print table of average WER grouped by reference sentence length.') - parser.add_argument('-m', '--min-word-count', type=int, default=10, metavar='count', - help='Minimum word count to show a word in confusions.') + parser.add_argument('-m', '--min-word-count', type=int, default=1, metavar='count', + help='Minimum word count to show a word in confusions (default 1).') parser.add_argument('-a', '--case-insensitive', action='store_true', help='Down-case the text before running the evaluation.') parser.add_argument('-e', '--remove-empty-refs', action='store_true', diff --git a/asr_evaluation/asr_evaluation.py b/asr_evaluation/asr_evaluation.py index fa97303..b692d6b 100644 --- a/asr_evaluation/asr_evaluation.py +++ b/asr_evaluation/asr_evaluation.py @@ -239,17 +239,17 @@ def print_confusions(): if len(insertion_table) > 0: print('INSERTIONS:') for item in sorted(list(insertion_table.items()), key=lambda x: x[1], reverse=True): - if item[1] > min_count: + if item[1] >= min_count: print('{0:20s} {1:10d}'.format(*item)) if len(deletion_table) > 0: print('DELETIONS:') for item in sorted(list(deletion_table.items()), key=lambda x: x[1], reverse=True): - if item[1] > min_count: + if item[1] >= min_count: print('{0:20s} {1:10d}'.format(*item)) if len(substitution_table) > 0: print('SUBSTITUTIONS:') for [w1, w2], count in sorted(list(substitution_table.items()), key=lambda x: x[1], reverse=True): - if count > min_count: + if count >= min_count: print('{0:20s} -> {1:20s} {2:10d}'.format(w1, w2, count)) # TODO - For some reason I was getting two different counts depending on how I count the matches, diff --git a/setup.py b/setup.py index 9cc631e..91e21d6 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup -version='2.0.1' +version='2.0.2' setup( name='asr_evaluation',