From e06e128d7360a9edd3e5069d79321387fa0d2949 Mon Sep 17 00:00:00 2001 From: Huahuan Zheng <32546978+maxwellzh@users.noreply.github.com> Date: Fri, 29 Dec 2023 13:59:18 +0800 Subject: [PATCH] Fix finalize error in contextgraph --- icefall/context_graph.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/icefall/context_graph.py b/icefall/context_graph.py index b3d7972a8..315933683 100644 --- a/icefall/context_graph.py +++ b/icefall/context_graph.py @@ -240,8 +240,11 @@ class ContextGraph: the score is zero, otherwise the score is the score of a implicit fail arc to root. The next state is always root. """ - # The score of the fail arc - score = -state.node_score + if state.is_end: + score = 0.0 + else: + # The score of the fail arc + score = -state.node_score return (score, self.root) def draw(