speech_asr před 3 roky
rodič
revize
fab0da6ab7
1 změnil soubory, kde provedl 3 přidání a 7 odebrání
  1. 3 7
      funasr/datasets/preprocessor.py

+ 3 - 7
funasr/datasets/preprocessor.py

@@ -47,15 +47,11 @@ def forward_segment(text, dic):
 
 
 def seg_tokenize(txt, seg_dict):
 def seg_tokenize(txt, seg_dict):
     out_txt = ""
     out_txt = ""
-    pattern = re.compile(r"([\u4E00-\u9FA5A-Za-z0-9])")
     for word in txt:
     for word in txt:
-        if pattern.match(word):
-            if word in seg_dict:
-                out_txt += seg_dict[word] + " "
-            else:
-                out_txt += "<unk>" + " "
+        if word in seg_dict:
+            out_txt += seg_dict[word] + " "
         else:
         else:
-            continue
+            out_txt += "<unk>" + " "
     return out_txt.strip().split()
     return out_txt.strip().split()
 
 
 def seg_tokenize_wo_pattern(txt, seg_dict):
 def seg_tokenize_wo_pattern(txt, seg_dict):