mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44:13 +08:00
.
This commit is contained in:
parent
23474a9348
commit
98b89cd43f
@ -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
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user