INNER CODE UNIT · Python

is_korean_line

sangrokjung/claude-forge · scripts/emdash_slop_check.py:81

def is_korean_line(line: str, threshold: float = KOREAN_RATIO_THRESHOLD) -> bool:
    """True if this single line reads as Korean rather than English.

    Runs after the whole-file gate, on the line about to be recorded. Korean
    documents quote English, and an em-dash aside inside an English sentence
    is correct English prose — flagging it is noise regardless of what
    language the rest of the file is in.

    Same tradeoff as the file gate, one level down: a Korean sentence whose
    line happens to be mostly Latin (a long path or identifier) is skipped.
    Under-reporting on a bilingual line is cheaper than training the reader
    to ignore this checker.
    """
    return _hangul_ratio(line) >= threshold


def check_file(path: str):
    try:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…