liear_fst_with_self_loops (#512)

This commit is contained in:
LIyong.Guo 2022-08-02 22:28:12 +08:00 committed by GitHub
parent 2f75236c05
commit 132132f52a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -330,12 +330,14 @@ class Nbest(object):
# We use a word fsa to intersect with k2.invert(lattice)
word_fsa = k2.invert(self.fsa)
word_fsa.scores.zero_()
if hasattr(lattice, "aux_labels"):
# delete token IDs as it is not needed
del word_fsa.aux_labels
word_fsa_with_epsilon_loops = k2.linear_fsa_with_self_loops(word_fsa)
else:
word_fsa_with_epsilon_loops = k2.linear_fst_with_self_loops(word_fsa)
word_fsa.scores.zero_()
word_fsa_with_epsilon_loops = k2.linear_fsa_with_self_loops(word_fsa)
path_to_utt_map = self.shape.row_ids(1)