fix(tools): 애니 파이프라인 버그 4건 수정 — Unicode SyntaxError, 카타카나 변환, Nyaa 검색 전략 + Python 환경 설정

This commit is contained in:
2026-03-08 17:43:54 +09:00
parent a3a083f6da
commit 1dab257401
12 changed files with 109 additions and 30 deletions

View File

@@ -53,11 +53,12 @@ _KATA_OFFSET = ord('ア') - ord('あ')
def _kata_to_hira(text: str) -> str:
"""카타카나를 히라가나로 변환."""
"""카타카나를 히라가나로 변환 (ー 장음기호는 유지)."""
result = []
for ch in text:
cp = ord(ch)
if 0x30A0 <= cp <= 0x30FF: # 카타카나 범위
# 카타카나 범위이되, ー(U+30FC), ・(U+30FB) 등 기호는 제외
if 0x30A1 <= cp <= 0x30F6: # ア~ヶ (실제 카타카나 문자만)
result.append(chr(cp - _KATA_OFFSET))
else:
result.append(ch)
@@ -71,6 +72,11 @@ def japanese_to_romaji(text: str) -> str:
result = []
i = 0
while i < len(text):
# 장음 기호 (ー U+30FC, ー가 히라가나로 안 변환되므로 여기서 처리)
if text[i] == '\u30FC': # ー
# 장음: 이전 모음 반복 (간략화: 스킵)
i += 1
continue
# 2글자 매칭 우선 (きゃ 등)
if i + 1 < len(text) and text[i:i+2] in _KANA_ROMAJI:
result.append(_KANA_ROMAJI[text[i:i+2]])
@@ -85,8 +91,6 @@ def japanese_to_romaji(text: str) -> str:
else:
result.append(romaji)
i += 1
elif text[i] == '': # 장음
i += 1
else:
# 한자, 영어, 숫자 등 → 그대로
result.append(text[i])