diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | swr2_asr/utils/decoder.py | 1 | ||||
-rw-r--r-- | swr2_asr/utils/tokenizer.py | 6 |
3 files changed, 8 insertions, 2 deletions
@@ -67,8 +67,7 @@ cover/ *.mo *.pot -#Model -YOUR + # Django stuff: *.log diff --git a/swr2_asr/utils/decoder.py b/swr2_asr/utils/decoder.py index fcddb79..ef8de49 100644 --- a/swr2_asr/utils/decoder.py +++ b/swr2_asr/utils/decoder.py @@ -24,3 +24,4 @@ def greedy_decoder(output, labels, label_lengths, tokenizer: CharTokenizer, coll # TODO: add beam search decoder + diff --git a/swr2_asr/utils/tokenizer.py b/swr2_asr/utils/tokenizer.py index 1cc7b84..ee89cdb 100644 --- a/swr2_asr/utils/tokenizer.py +++ b/swr2_asr/utils/tokenizer.py @@ -120,3 +120,9 @@ class CharTokenizer: load_tokenizer.char_map[char] = int(index) load_tokenizer.index_map[int(index)] = char return load_tokenizer + + def create_txt(self,path:str): + with open(path, 'w',encoding="utf-8") as file: + for key,value in self.char_map(): + file.write(f"{key}\n") +
\ No newline at end of file |