korean-character-count

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

한국어 글자 수 세기

韩文文本数量统计

What this skill does

本技能功能

자기소개서, 지원서, 자유서술형 폼처럼 글자 수 제한이 중요한 한국어 텍스트를 대상으로 LLM 추정 없이 결정론적으로 카운트한다.
  • 기본 글자 수:
    Intl.Segmenter
    기반 Unicode extended grapheme cluster
  • 줄 수:
    CRLF
    ,
    LF
    ,
    CR
    ,
    U+2028
    ,
    U+2029
    를 줄바꿈 1회로 계산
  • 기본 byte 수: UTF-8 실제 인코딩 길이
  • 호환 프로필:
    neis
    byte 규칙
针对自我介绍、申请书、自由填写式表单这类对字数限制要求严格的韩文文本,无需LLM估算,以确定性方式进行统计。
  • 基础字数:
    Intl.Segmenter
    基于Unicode扩展字符簇
  • 行数:
    CRLF
    ,
    LF
    ,
    CR
    ,
    U+2028
    ,
    U+2029
    计为1次换行
  • 基础字节数:UTF-8实际编码长度
  • 兼容配置:
    neis
    字节规则

When to use

适用场景

  • "이 자기소개서 1000자 넘는지 정확히 세줘"
  • "이 텍스트를 UTF-8 byte 기준으로 계산해줘"
  • "줄 수랑 byte 수도 같이 알려줘"
  • "한글/영문/이모지 섞인 문장을 추정 말고 코드로 세줘"
  • "帮我准确统计这份自我介绍是否超过1000字"
  • "帮我按UTF-8字节标准计算这段文本的长度"
  • "也告诉我行数和字节数"
  • "用代码精确统计韩文/英文/表情混合的句子,不要估算"

Why this skill exists

技能开发背景

  • 글자 수 제한은 1자 차이도 민감하다.
  • LLM이 글자 수를 눈대중으로 예측하면 재현성이 없다.
  • 이 스킬은 입력을 임의로 trim/정규화하지 않고, 문서화된 계약으로만 센다.
  • 字数限制对哪怕1字的差异都很敏感。
  • LLM估算字数缺乏可重复性。
  • 本技能不会随意修剪/规范化输入,仅按照文档化的规则进行统计。

Contracts

统计规则

default
profile

default
配置

  • characters:
    Intl.Segmenter("ko", { granularity: "grapheme" })
  • bytes:
    Buffer.byteLength(text, "utf8")
  • lines:
    • empty string =>
      0
    • non-empty => 줄바꿈 시퀀스 수 +
      1
    • CRLF
      2
      줄바꿈이 아니라
      1
      줄바꿈으로 센다.
  • 字符数:
    Intl.Segmenter("ko", { granularity: "grapheme" })
  • 字节数:
    Buffer.byteLength(text, "utf8")
  • 行数:
    • 空字符串 =>
      0
    • 非空字符串 => 换行序列数量 +
      1
    • CRLF
      计为1次换行,而非2次

neis
profile

neis
配置

  • characters:
    default
    와 동일
  • lines:
    default
    와 동일
  • bytes:
    • 한글 grapheme =>
      3B
    • ASCII grapheme =>
      1B
    • Enter/줄바꿈 시퀀스 =>
      2B
    • 그 외 문자는 UTF-8 byte 길이로 fallback
  • 字符数:与
    default
    一致
  • 行数:与
    default
    一致
  • 字节数:
    • 韩文字符簇 =>
      3B
    • ASCII字符簇 =>
      1B
    • 回车/换行序列 =>
      2B
    • 其他字符回退到UTF-8字节长度

Prerequisites

前置条件

  • node
    18+
  • 설치된 skill payload 안에
    scripts/korean_character_count.js
    helper 포함
  • 별도 API 키 없음
  • node
    18+
  • 已安装的skill payload中包含
    scripts/korean_character_count.js
    辅助脚本
  • 无需额外API密钥

Workflow

工作流程

  1. 텍스트를 직접 받거나 파일/STDIN으로 읽는다.
  2. node scripts/korean_character_count.js
    로 결정론적 카운트를 실행한다.
  3. 필요한 프로필(
    default
    /
    neis
    )과 출력 형식(
    json
    /
    text
    )을 고른다.
  4. 결과를 그대로 반환하고, 어떤 계약으로 셌는지 함께 알려준다.
  1. 直接接收文本,或从文件/STDIN读取文本。
  2. 运行
    node scripts/korean_character_count.js
    执行确定性统计。
  3. 选择所需配置(
    default
    /
    neis
    )和输出格式(
    json
    /
    text
    )。
  4. 直接返回结果,并说明采用的统计规则。

CLI examples

CLI示例

bash
node scripts/korean_character_count.js --text "가나다"
node scripts/korean_character_count.js --text $'첫 줄\r\n둘째 줄🙂'
node scripts/korean_character_count.js --text $'첫 줄\n둘째 줄🙂' --profile neis --format text
node scripts/korean_character_count.js --file ./essay.txt --profile default
cat essay.txt | node scripts/korean_character_count.js --stdin --profile neis
bash
node scripts/korean_character_count.js --text "가나다"
node scripts/korean_character_count.js --text $'첫 줄\r\n둘째 줄🙂'
node scripts/korean_character_count.js --text $'첫 줄\n둘째 줄🙂' --profile neis --format text
node scripts/korean_character_count.js --file ./essay.txt --profile default
cat essay.txt | node scripts/korean_character_count.js --stdin --profile neis

Response policy

响应规则

  • 추정하지 말고 helper 결과를 그대로 쓴다.
  • 어떤 profile로 셌는지 함께 보여준다.
  • 기본값이 필요하면
    default
    profile을 사용한다.
  • 제출처가 NEIS/학교생활기록부 같은 별도 계약을 요구할 때만
    neis
    를 쓴다.
  • 不要估算,直接使用辅助脚本的结果。
  • 同时说明采用的配置。
  • 需要默认值时使用
    default
    配置。
  • 仅当提交对象要求NEIS/学生档案等特殊规则时,才使用
    neis
    配置。

Done when

完成标准

  • 글자 수, 줄 수, byte 수가 함께 반환된다.
  • default
    neis
    계약 차이가 문서에 명시된다.
  • node scripts/korean_character_count.js --help
    가 동작한다.
  • 혼합 한국어/영문/공백/개행/emoji 입력에 대한 테스트가 있다.
  • 同时返回字符数、行数、字节数。
  • 文档中明确
    default
    neis
    规则的差异。
  • node scripts/korean_character_count.js --help
    可正常运行。
  • 包含对韩文/英文/空格/换行/emoji混合输入的测试。

Notes

参考资料