re-pull-request allow tokens and hotwords be loaded from buffered string driectly (#1339)
Co-authored-by: xiao <shawl336@163.com>
This commit is contained in:
@@ -44,10 +44,16 @@ class OnlineRecognizerTransducerNeMoImpl : public OnlineRecognizerImpl {
|
||||
const OnlineRecognizerConfig &config)
|
||||
: OnlineRecognizerImpl(config),
|
||||
config_(config),
|
||||
symbol_table_(config.model_config.tokens),
|
||||
endpoint_(config_.endpoint_config),
|
||||
model_(
|
||||
std::make_unique<OnlineTransducerNeMoModel>(config.model_config)) {
|
||||
if (!config.model_config.tokens_buf.empty()) {
|
||||
symbol_table_ = SymbolTable(config.model_config.tokens_buf, false);
|
||||
} else {
|
||||
/// assuming tokens_buf and tokens are guaranteed not being both empty
|
||||
symbol_table_ = SymbolTable(config.model_config.tokens, true);
|
||||
}
|
||||
|
||||
if (config.decoding_method == "greedy_search") {
|
||||
decoder_ = std::make_unique<OnlineTransducerGreedySearchNeMoDecoder>(
|
||||
model_.get(), config_.blank_penalty);
|
||||
|
||||
Reference in New Issue
Block a user