Skip to main content

kocer

한국어 STT를 공정하게 채점하는 CER — 띄어쓰기·숫자·문장부호·영문 약어 표기 차이를 오류로 세지 않습니다.

Fair CER/WER for Korean speech recognition. Spacing, punctuation, number notation (3개 ↔ 세 개) and Latin acronyms (AI ↔ 에이아이) are not counted as errors. Pure Python, zero dependencies, jiwer-compatible API.

ref: 사과 세 개 주세요
hyp: 사과 3개 주세요
jiwer CER 0.200   nlptutti CER 0.143   kocer CER 0.000

설치

pip install kocer          # 순수 파이썬, 의존성 없음
pip install kocer[fast]    # rapidfuzz로 채점 수십 배 빠름. 긴 문장(자막·회의록)을 많이 재면 권장

사용

import kocer

kocer.cer("사과 세 개 주세요", "사과 3개 주세요")   # 0.0
kocer.cer(refs, hyps)                                # 리스트도 됨 (jiwer와 같은 코퍼스 집계)
kocer.wer(ref, hyp)

r = kocer.measure("세 시 삼십 분", "3시 30분")
r.cer         # 0.0  정규화 후
r.raw_cer     # 0.625  정규화 전 (jiwer와 같은 값). 둘의 차이가 "가짜 오류"의 크기
r.ops         # {'S': 0, 'D': 0, 'I': 0}
r.alignment   # [('H', '세', '세'), ...]
r.chosen_ref  # 숫자 후보 중 실제로 채택된 정답
r.chosen_hyp  # '세시삼십분'

# 단어처럼 읽는 약어는 직접 넘김 (내장 사전 위에 덮어씀)
kocer.cer("엘지 트윈스", "LG 트윈스")                      # 0.0  철자 읽기
kocer.cer("케이비오 리그", "KBO 리그")                      # 0.0
kocer.cer("유니스트 입학", "UNIST 입학", aliases={"UNIST": "유니스트"})  # 0.0
kocer ref.txt hyp.txt          # 줄 단위 쌍, raw CER과 kocer CER을 같이 출력
kocer ref.txt hyp.txt --diff   # 틀린 글자만 색으로 표시

무엇을 무시하고, 무엇을 세는가

정규화는 순서대로 적용되고 각 단계를 끌 수 있습니다.

단계 기본 끄기 예
유니코드 NFC 켬 - 자모 분리 입력
문장부호 제거 켬 punct=False 네, 알겠습니다. = 네 알겠습니다
필러 제거 (음, 어, 그) 끔 fillers=True 실제 단어 "그"도 지워질 수 있어 기본은 끔
영문 약어·단위 켬 letters=False AI = 에이아이, NASA = 나사, 50% = 50퍼센트
숫자 후보 전개 켬 numbers=False 3개 = 세 개, 3층 = 삼 층
공백 제거 CER만 - WER은 공백 유지

normalize=False면 jiwer와 같은 순수 CER을 돌려줍니다.

숫자: 정답 하나가 아니라 후보 집합

숫자는 조수사에 따라 읽기가 달라서(3개=세 개, 3층=삼 층, 3시 30분=세 시 삼십 분) 규칙 하나로 정답을 만들 수 없습니다. kocer는 숫자마다 {원문 숫자, 한자어 읽기, 고유어 읽기, 자릿수 읽기} 후보를 만들고 CER이 최소가 되는 조합을 고릅니다.

  • 조수사 사전(counters.py)에 있으면 그 읽기만, 없으면 두 읽기 모두 허용합니다. 틀리게 감점하는 것보다 관대한 쪽이 안전하다는 정책입니다.
  • 반대 방향(ref가 한글 수사, hyp가 숫자)도 처리합니다.
  • 전화번호·연도는 자릿수 읽기(010 = 공일공, 2024 = 이공이사)도 후보에 들어갑니다.
  • 고유어 읽기는 1~99까지. 100개는 백 개만 허용하고, 백스무 명(120명)은 아직 안 됩니다.
  • 숫자 하나에 후보가 많아 조합이 64개를 넘으면 숫자 구간마다 따로 최적 후보를 고르는 근사를 씁니다.

"너무 관대하다"는 비판에 대해

정규화는 실제 오류를 숨길 수 있습니다. 그래서 raw_cer를 항상 같이 돌려주고, 모든 단계를 끌 수 있게 했습니다. 두 값을 같이 보고하세요.

기존 도구 비교 (2026-10-23 실측)

nlptutti 0.0.0.24, jiwer 4.0.0. tests/cases.tsv의 케이스 일부.

ref hyp jiwer nlptutti kocer
사과 세 개 주세요 사과 3개 주세요 0.200 0.143 0.000
삼 층으로 가세요 3층으로 가세요 0.222 0.143 0.000
세 시 삼십 분 3시 30분 0.625 0.600 0.000
에이아이 모델 AI 모델 0.571 0.667 0.000
네, 알겠습니다. 네 알겠습니다 0.222 0.000 0.000
오늘날씨가좋다 오늘 날씨가 좋다 0.286 0.000 0.000

nlptutti는 띄어쓰기·문장부호를 이미 처리하고, CLI·코퍼스 비교 리포트·개체명 평가 등 kocer에 없는 기능이 많습니다. kocer의 차이는 숫자·영문 약어 정규화와 raw_cer 대비 표시입니다.

한계

  • 대문자 연속은 철자로 읽습니다(AI = 에이아이). 단어처럼 읽는 약어는 aliases로 넘기세요. NASA, UNESCO, COVID 등 16개만 내장되어 있습니다.
  • 단위 기호는 %, km, kg, cm, mm, ml만 한글로 바꿉니다. 3m은 삼 미터와 다른 것으로 봅니다.
  • WER은 띄어쓰기 차이를 오류로 셉니다. 한국어 WER의 본질적 한계이고, CER을 권합니다.
  • 조수사 사전은 완전하지 않습니다. 사전에 없는 조수사는 두 읽기를 다 허용합니다. 케이스를 tests/cases.tsv에 추가하는 PR을 환영합니다.
  • 입력은 텍스트 쌍만 받습니다. 음성 파일·모델 실행은 다루지 않습니다.

라이선스

MIT

Metadata

Release files for kocer 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kocer 0.1.2
File Size Uploaded Provenance
kocer-0.1.2.tar.gz 13.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for kocer 0.1.2
File Interpreter ABI Platform
kocer-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 27.0 kB

Release files / kocer-0.1.2.tar.gz

Download URL kocer-0.1.2.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
da125bc3d1b8edf8a3cb5b8f4fe1b9eea12543b0b55cab4a6eb3848ccf68014d
BLAKE2b-256 checksum
How to use checksums
8fdd67fcb4608d7e45367da195eff5251ad9846bb88ca67a60471df4b56e1b65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / kocer-0.1.2-py3-none-any.whl

Download URL kocer-0.1.2-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b77be4498da21d8c91fc147c93a3daf3976bbdcca51911d4032c0cd7ddf8d1f
BLAKE2b-256 checksum
How to use checksums
db78a7bd6fd62e2076b9f63055f7a9c250107c0ca7ae1d0d73a210ec9cd639d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for kocer 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kocer-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page