From 20e7106d6000ce306cbbc2ee6e0a23ab529f0ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Tue, 14 May 2024 22:34:54 +0800 Subject: [PATCH] fix --- LunaTranslator/LunaTranslator/hiraparse/mecab.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/LunaTranslator/LunaTranslator/hiraparse/mecab.py b/LunaTranslator/LunaTranslator/hiraparse/mecab.py index ff40df54..7c00b897 100644 --- a/LunaTranslator/LunaTranslator/hiraparse/mecab.py +++ b/LunaTranslator/LunaTranslator/hiraparse/mecab.py @@ -48,16 +48,22 @@ class hira: orig = text[start : start + l] if origorig is None: origorig = orig - - if "-" in origorig: - hira = origorig.split("-")[1] - origorig = origorig.split("-")[0] + + start += l hira = kana # .translate(self.h2k) if hira == "*": hira = "" # print(node.feature) + + if "-" in origorig: + try: + hira = origorig.split("-")[1] + origorig = origorig.split("-")[0] + except: + pass + result.append( {"orig": orig, "hira": hira, "cixing": pos1, "origorig": origorig} )