From 8a72901f3aa424893b866715f6b4faa6c4c9d3f7 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Tue, 20 Jul 2021 19:54:12 +0800 Subject: [PATCH] Minor fixes. --- egs/librispeech/ASR/local/prepare_lang.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/egs/librispeech/ASR/local/prepare_lang.py b/egs/librispeech/ASR/local/prepare_lang.py index a568cc8a9..22485cac9 100755 --- a/egs/librispeech/ASR/local/prepare_lang.py +++ b/egs/librispeech/ASR/local/prepare_lang.py @@ -41,9 +41,6 @@ def read_lexicon(filename: str) -> Lexicon: That is, the first field is a word and the remaining fields are phones. Fields are separated by space(s). - We assume that the input lexicon does not contain words: - , , , !SIL, , . - Args: filename: Path to the lexicon.txt @@ -51,10 +48,6 @@ def read_lexicon(filename: str) -> Lexicon: Returns: A list of tuples., e.g., [('w', ['p1', 'p2']), ('w1', ['p3, 'p4'])] """ - # ans = ["!SIL", ["SIL"]] - # ans.append(["", ["SPN"]]) - # ans.append(["", ["SPN"]]) - ans = [] with open(filename, "r", encoding="latin-1") as f: @@ -359,7 +352,7 @@ def main(): # whose ilabel is phone2id['#0'] and olable is word2id['#0'] # Need to implement it in k2 - if False: + if True: # Just for debugging, will remove it torch.save(L.as_dict(), out_dir / "L.pt") torch.save(L_disambig.as_dict(), out_dir / "L_disambig.pt") @@ -368,8 +361,8 @@ def main(): L.aux_labels_sym = k2.SymbolTable.from_file(out_dir / "words.txt") L_disambig.labels_sym = L.labels_sym L_disambig.aux_labels_sym = L.aux_labels_sym - L.draw(out_dir / "L.svg", title="L") - L_disambig.draw(out_dir / "L_disambig.svg", title="L_disambig") + L.draw(out_dir / "L.png", title="L") + L_disambig.draw(out_dir / "L_disambig.png", title="L_disambig") if __name__ == "__main__":