is_hanja
False이고, 문자열이 아닌 값은 TypeError입니다.
split_hanja / HanjaRun
HanjaRun에는 구간의 text와 판별 결과 is_hanja가 들어 있습니다.
부수, 획, 반복 부호 같은 한자 주변 기호는 한자로 분류하지 않습니다.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Unicode 한자를 판별하고 연속 구간으로 나누는 함수
is_hanja(char: str) -> bool
False이고, 문자열이 아닌 값은 TypeError입니다.
from hangulpy import is_hanja
print(is_hanja("字")) # True
print(is_hanja("𠀀")) # True (CJK Extension B)
print(is_hanja("한")) # False
print(is_hanja("漢字")) # False: 한 번에 한 글자만 검사
split_hanja(text: str) -> list[HanjaRun]
HanjaRun에는 구간의 text와 판별 결과 is_hanja가 들어 있습니다.
from hangulpy import split_hanja
for run in split_hanja("한字ABC𠀀끝"):
print(run.text, run.is_hanja)
# 한 False
# 字 True
# ABC False
# 𠀀 True
# 끝 False