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 git+https://github.com/Choi-kwan-u/kocer.git

사용

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 ref.txt hyp.txt          # 줄 단위 쌍, raw CER과 kocer CER을 같이 출력
kocer ref.txt hyp.txt --diff   # 틀린 글자만 색으로 표시

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

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

단계 기본 끄기 예
유니코드 NFC 켬 - 자모 분리 입력
문장부호 제거 켬 punct=False 네, 알겠습니다. = 네 알겠습니다
필러 제거 (음, 어, 그) 끔 fillers=True 실제 단어 "그"도 지워질 수 있어 기본은 끔
영문 약어·단위 켬 letters=False AI = 에이아이, 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개는 백 개만 허용합니다.

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

정규화는 실제 오류를 숨길 수 있습니다. 그래서 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 대비 표시입니다.

한계

  • WER은 띄어쓰기 차이를 오류로 셉니다. 한국어 WER의 본질적 한계이고, CER을 권합니다.
  • 조수사 사전은 완전하지 않습니다. 사전에 없는 조수사는 두 읽기를 다 허용합니다. 케이스를 tests/cases.tsv에 추가하는 PR을 환영합니다.
  • 입력은 텍스트 쌍만 받습니다. 음성 파일·모델 실행은 다루지 않습니다.

라이선스

MIT

Metadata

Release files for kocer 0.1.0

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.0
File Size Uploaded Provenance
kocer-0.1.0.tar.gz 11.7 kB With provenance Details

Built distribution (wheel)

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

Total release size: 23.5 kB

Release files / kocer-0.1.0.tar.gz

Download URL kocer-0.1.0.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
63b89a16aa561c2ae6cfecf218601da101e98be2d93b489a812e77dc586e66e0
BLAKE2b-256 checksum
How to use checksums
ca0c5fca7f45362f4235f0d39c045aca69c836af832da9afd3a184dd2bcfe0da
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.0-py3-none-any.whl

Download URL kocer-0.1.0-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2441a4080e032a94cd422914167a6260b5bdcaa775f76d18483cdd1292b4088
BLAKE2b-256 checksum
How to use checksums
4f9bdc63ac6ca397796969c34fbc28245369c86e6b881008fce55626054f74fe
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.0

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.0.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