This commit is contained in:
恍兮惚兮 2024-07-30 15:24:45 +08:00
parent 23474a9348
commit 98b89cd43f
2 changed files with 8 additions and 2 deletions

View File

@ -3,6 +3,10 @@ from traceback import print_exc
from myutils.proxy import getproxy from myutils.proxy import getproxy
class KnownException(Exception):
pass
class basehira: class basehira:
def init(self): def init(self):
pass pass
@ -86,6 +90,8 @@ class basehira:
hira[_]["hira"] = hira[_]["hira"].replace( hira[_]["hira"] = hira[_]["hira"].replace(
_ka[_reverse_idx], target[_reverse_idx] _ka[_reverse_idx], target[_reverse_idx]
) )
except KnownException:
pass
except: except:
print_exc() print_exc()
return hira return hira

View File

@ -2,7 +2,7 @@ import winsharedutils
import os, functools, csv, gobject import os, functools, csv, gobject
from ctypes import CFUNCTYPE, c_char_p from ctypes import CFUNCTYPE, c_char_p
from hiraparse.basehira import basehira from hiraparse.basehira import basehira, KnownException
# # 2.1.2 src schema # # 2.1.2 src schema
# UnidicFeatures17 = namedtuple('UnidicFeatures17', # UnidicFeatures17 = namedtuple('UnidicFeatures17',
@ -65,7 +65,7 @@ class mecabwrap:
fp = CFUNCTYPE(None, c_char_p, c_char_p)(cb) fp = CFUNCTYPE(None, c_char_p, c_char_p)(cb)
succ = winsharedutils.mecab_parse(self.kks, text.encode(codec), fp) succ = winsharedutils.mecab_parse(self.kks, text.encode(codec), fp)
if not succ: if not succ:
raise Exception # failed raise KnownException # failed
return res return res