From 5690a8bcb314ee53a5db1c704f6e3fe61460c7f6 Mon Sep 17 00:00:00 2001
From: shixian.shi <shixian.shi@alibaba-inc.com>
Date: 星期四, 06 七月 2023 18:53:09 +0800
Subject: [PATCH] update infer func for old contextual
---
funasr/datasets/large_datasets/utils/tokenize.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/funasr/datasets/large_datasets/utils/tokenize.py b/funasr/datasets/large_datasets/utils/tokenize.py
index 68f6f49..c16e1dc 100644
--- a/funasr/datasets/large_datasets/utils/tokenize.py
+++ b/funasr/datasets/large_datasets/utils/tokenize.py
@@ -56,12 +56,12 @@
if 'hw_tag' in data:
if hw_config['pre_hwlist'] is not None and hw_config['pre_prob'] > 0:
# enable preset hotword detect in sampling
- import pdb; pdb.set_trace()
pre_index = None
for hw in hw_config['pre_hwlist']:
- _find = text.find(hw)
+ hw = " ".join(seg_tokenize(hw, seg_dict))
+ _find = " ".join(text).find(hw)
if _find != -1:
- _find = text[:_find].count(" ") # bpe sometimes
+ # _find = text[:_find].count(" ") # bpe sometimes
pre_index = [_find, _find + max(hw.count(" "), 1)]
break
hotword_indxs = sample_hotword(length, **hw_config, pre_index=pre_index)
--
Gitblit v1.9.1