From b71f0428f52d3a50151a0bdfbcef366c1367f235 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Mon, 10 Apr 2023 14:38:55 +0800 Subject: [PATCH] small fixes --- icefall/shared/combine_lm.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/icefall/shared/combine_lm.py b/icefall/shared/combine_lm.py index aed55baaa..d7b85e1b4 100755 --- a/icefall/shared/combine_lm.py +++ b/icefall/shared/combine_lm.py @@ -170,11 +170,9 @@ def _process_grams( log10_p_a_backoff = 0 if len(s) < order + 2 else float(s[-1]) log10_p_b = get_score(b, history, word) - if a_scale * log10_p_a < b_scale * log10_p_b: - # ensure that the resulting log10_p_a is negative - log10_p_a = a_scale * log10_p_a - b_scale * log10_p_b - else: - log10_p_a *= a_scale + + # ensure that the resulting log10_p_a is not positive + log10_p_a = min(0, a_scale * log10_p_a - b_scale * log10_p_b) log10_p_a_backoff *= a_scale