-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
61 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,30 @@ | ||
from wenet.text.base_tokenizer import BaseTokenizer | ||
from wenet.text.wenet_tokenizer import WenetTokenizer | ||
from wenet.text.bpe_tokenizer import BpeTokenizer | ||
from wenet.text.char_tokenizer import CharTokenizer | ||
from wenet.text.whisper_tokenizer import WhisperTokenizer | ||
|
||
|
||
def init_tokenizer(configs, args, non_lang_syms) -> BaseTokenizer: | ||
def init_tokenizer(configs, | ||
symbol_table, | ||
bpe_model=None, | ||
non_lang_syms=None) -> BaseTokenizer: | ||
# TODO: | ||
# 1 huggface tokenizer | ||
# 2 paraformer tokenizer | ||
|
||
if configs.get("whisper", False): | ||
tokenizer = WhisperTokenizer( | ||
multilingual=configs['whisper_conf']['is_multilingual'], | ||
num_languages=configs['whisper_conf']['num_languages']) | ||
elif bpe_model is None: | ||
tokenizer = CharTokenizer(symbol_table, | ||
non_lang_syms, | ||
split_with_space=configs.get( | ||
'split_with_space', False)) | ||
else: | ||
tokenizer = WenetTokenizer(args.symbol_table, args.bpe_model, | ||
non_lang_syms, | ||
configs.get('split_with_space', False)) | ||
tokenizer = BpeTokenizer(bpe_model, | ||
symbol_table, | ||
split_with_space=configs.get( | ||
'split_with_space', False)) | ||
|
||
return tokenizer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters