Просмотр исходного кода

Merge pull request #745 from alibaba-damo-academy/dev_lhn

fix hotword tokenize
hnluo 2 лет назад
Родитель
Сommit
33f1a9c1d9
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      funasr/datasets/large_datasets/utils/tokenize.py

+ 1 - 1
funasr/datasets/large_datasets/utils/tokenize.py

@@ -54,9 +54,9 @@ def tokenize(data,
 
     length = len(text)
     if 'hw_tag' in data:
+        pre_index = None
         if hw_config['pre_hwlist'] is not None and hw_config['pre_prob'] > 0:
             # enable preset hotword detect in sampling
-            pre_index = None
             for hw in hw_config['pre_hwlist']:
                 hw = " ".join(seg_tokenize(hw, seg_dict))
                 _find = " ".join(text).find(hw)