INNER CODE UNIT · Python
total
sangrokjung/claude-forge · scripts/emdash_slop_check.py:64
total = hangul + latin
if total == 0:
return 0.0
return hangul / total
def is_korean_dominant(text: str, threshold: float = KOREAN_RATIO_THRESHOLD) -> bool:
"""True if the file's letters are mostly Hangul rather than Latin.
Deliberate tradeoff: this is a whole-file ratio. A mostly-English doc with
one Korean paragraph containing a real em-dash violation will not be
flagged — that's the accepted cost of not firing on English docs at all
(the false-positive class this checker exists to eliminate).
"""
return _hangul_ratio(text) >= threshold
def is_korean_line(line: str, threshold: float = KOREAN_RATIO_THRESHOLD) -> bool: