from local

This commit is contained in:
dohe0342 2023-02-25 15:38:05 +09:00
parent 48b2dddcd9
commit ef329c07b5
2 changed files with 13 additions and 0 deletions

View File

@ -411,6 +411,19 @@ def decode_one_batch(
key = "ctc-greedy-search"
return {key: hyps}
if params.method == "greedy-search":
hyps = greedy_search(nnet_output, memory_key_padding_mask)
# hyps is a list of str, e.g., ['xxx yyy zzz', ...]
hyps = bpe_model.decode(hyps)
# hyps is a list of list of str, e.g., [['xxx', 'yyy', 'zzz'], ... ]
unk = bpe_model.decode(bpe_model.unk_id()).strip()
hyps = [[w for w in s.split() if w != unk] for s in hyps]
key = "ctc-greedy-search"
return {key: hyps}
if params.method == "nbest-oracle":
# Note: You can also pass rescored lattices to it.