Fangjun Kuang
Committed by GitHub

Fix initializing symbol table for OnlineRecognizer. (#2590)

@@ -79,6 +79,7 @@ class OnlineRecognizerCtcImpl : public OnlineRecognizerImpl { @@ -79,6 +79,7 @@ class OnlineRecognizerCtcImpl : public OnlineRecognizerImpl {
79 : OnlineRecognizerImpl(config), 79 : OnlineRecognizerImpl(config),
80 config_(config), 80 config_(config),
81 model_(OnlineCtcModel::Create(config.model_config)), 81 model_(OnlineCtcModel::Create(config.model_config)),
  82 + sym_(config.model_config.tokens),
82 endpoint_(config_.endpoint_config) { 83 endpoint_(config_.endpoint_config) {
83 PostInit(); 84 PostInit();
84 } 85 }
@@ -242,10 +243,8 @@ class OnlineRecognizerCtcImpl : public OnlineRecognizerImpl { @@ -242,10 +243,8 @@ class OnlineRecognizerCtcImpl : public OnlineRecognizerImpl {
242 private: 243 private:
243 void PostInit() { 244 void PostInit() {
244 if (!config_.model_config.tokens_buf.empty()) { 245 if (!config_.model_config.tokens_buf.empty()) {
245 - sym_ = SymbolTable(config_.model_config.tokens_buf, false);  
246 - } else {  
247 /// assuming tokens_buf and tokens are guaranteed not being both empty 246 /// assuming tokens_buf and tokens are guaranteed not being both empty
248 - sym_ = SymbolTable(config_.model_config.tokens, true); 247 + sym_ = SymbolTable(config_.model_config.tokens_buf, false);
249 } 248 }
250 249
251 if (!config_.model_config.wenet_ctc.model.empty()) { 250 if (!config_.model_config.wenet_ctc.model.empty()) {