Fix finalize error in contextgraph

This commit is contained in:
Huahuan Zheng 2023-12-29 13:59:18 +08:00 committed by GitHub
parent 140e6381ad
commit e06e128d73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(