From 2e36e738ca39afc8d02f3d11013bd12f937cc874 Mon Sep 17 00:00:00 2001
From: zhaomingwork <61895407+zhaomingwork@users.noreply.github.com>
Date: 星期三, 08 十一月 2023 09:22:06 +0800
Subject: [PATCH] fix bug for h5 hotwords (#1067)

---
 funasr/datasets/preprocessor.py |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/funasr/datasets/preprocessor.py b/funasr/datasets/preprocessor.py
index bd2c972..9b5c4e7 100644
--- a/funasr/datasets/preprocessor.py
+++ b/funasr/datasets/preprocessor.py
@@ -11,7 +11,7 @@
 import numpy as np
 import scipy.signal
 import soundfile
-
+import jieba
 
 from funasr.text.build_tokenizer import build_tokenizer
 from funasr.text.cleaner import TextCleaner
@@ -201,7 +201,7 @@
         self.seg_dict = None
         if seg_dict_file is not None:
             self.seg_dict = {}
-            with open(seg_dict_file) as f:
+            with open(seg_dict_file, "r", encoding="utf8") as f:
                 lines = f.readlines()
             for line in lines:
                 s = line.strip().split()
@@ -659,7 +659,6 @@
         self.split_text_name = split_text_name
         self.seg_jieba = seg_jieba
         if self.seg_jieba:
-            import jieba
             jieba.load_userdict(seg_dict_file)
 
     @classmethod

--
Gitblit v1.9.1