Skip to content

fix(check): a Korean number and its counter count as one word in line reading time - #7343

Merged
miguel-heygen merged 2 commits into
mainfrom
fix/check-korean-reading-words
Nov 7, 2026
Merged

miguel-heygen merged 2 commits into
mainfrom
fix/check-korean-reading-words

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

What

check no longer counts a number and the Korean counter written against it (12회, 3건) as two words, so a short Korean counter line gets the same 0.4 s short-line allowance as Failures: 12.

Why

A film with Korean failure counters (실패 12회) drew line_unread warnings that did not apply. readingWords ran every letter/number run through a Japanese dictionary segmenter. ICU cuts a digit run from the letters stuck to it in every locale (checked ja, ko, en, zh: all give 12|회), so picking a Korean locale would not help. 실패 12회 counted 3 words, crossed the 2-word short-line limit, and needed a 1.05 s hold instead of 0.4 s.

How

Only runs that contain Han, kana, Thai, Lao, Khmer or Myanmar letters go to the dictionary segmenter (these scripts have no spaces). Every other run (Korean, Latin, ...) is already one word per space-delimited run. Japanese counting is unchanged, and Thai, Lao, Khmer and Burmese lines are still segmented (test added): 12回 stays 2 and 実行12回失敗 stays 4, pinned by a test.

Size

A six-line fix in one function plus its tests. Nothing else in flight touches readingWords, so there is no PR to fold it into.

Test plan

  • Unit tests added: cd packages/cli && npx vitest run src/utils/craftAudit.test.ts, 26 passed, 3 runs in a row.
  • fails without the fix: the new Korean test fails on main's craftAudit.ts.
  • oxlint and oxfmt clean on both files; comment share of craftAudit.ts goes 5.09% to 5.05%.

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes at dc55c8e8.

Blocker: Thai, Lao, Khmer and Burmese lines now count as one word. The new guard sends a run to the dictionary segmenter only if it contains Han or kana, so every other run counts as 1. Korean is spaced, so that's correct for it. But Thai, Lao, Khmer and Burmese don't use spaces either, and before this change ICU's dictionary split them. Same WORD_RUNS and segmenter as the head, old vs new count:

text main head
การทดสอบล้มเหลวสิบสองครั้งในวันนี้ (Thai) 10 1
ທົດສອບລົ້ມເຫລວສິບສອງຄັ້ງ (Lao) 5 1
ការធ្វើតេស្តបរាជ័យដប់ពីរដង (Khmer) 5 1
စမ်းသပ်မှုဆယ့်နှစ်ကြိမ်ကျရှုံးခဲ့သည် (Burmese) 7 1

So a long Thai caption now gets the 0.4 s short-line allowance, and line_unread misses it. That swaps a false warning for a missed one in a different script.

Suggested fix: flip the guard so that only Hangul skips the segmenter (e.g. /\p{Script=Hangul}/u.test(run) ? 1 : segment(run)). Then add a Thai case (readingWords("การทดสอบล้มเหลว…") > 1) next to the Japanese pin.

Verified otherwise:

  • npx vitest run src/utils/craftAudit.test.ts at head: 26 passed.
  • fails without the fix: holds. With main's craftAudit.ts and the PR's tests, "counts Korean by its spaces…" fails on 실패 12회 (3 ≠ 2).
  • The Japanese pins (12回 = 2, 実行12回失敗 = 4) and the Latin/% cases are unchanged.

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 267 (base branch 267), smooth 104 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (8)

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve at 7815874f.

My earlier blocker is fixed. Thai, Lao, Khmer and Myanmar now go through the dictionary segmenter again. Those are the unspaced scripts ICU has dictionaries for, along with Han and kana, so for every other script (Korean, Latin, …) one space-delimited run is one word. The new "still segments scripts written without spaces" test pins all four.

Verified at this head:

  • npx vitest run src/utils/craftAudit.test.ts: 27 passed.
  • fails without the fix: holds. With main's craftAudit.ts and the PR's tests, "counts Korean by its spaces…" fails.

Nit (not blocking): the test plan still says 26 passed; it's 27 now.

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit bc2773d Nov 7, 2026
130 of 131 checks passed
@miguel-heygen
miguel-heygen deleted the fix/check-korean-reading-words branch November 7, 2026 04:34
SanHsien added a commit to SanHsien/hyperframes that referenced this pull request Nov 7, 2026
…-com#7336-heygen-com#7358

Adopt heygen-com#7304 (without CLI renderDiagnostic, needs heygen-com#6725), heygen-com#7331, heygen-com#7332, heygen-com#7334,
heygen-com#7337, heygen-com#7336, heygen-com#7339, heygen-com#7289, heygen-com#5594, heygen-com#6900, heygen-com#7322, heygen-com#7342, heygen-com#7343, heygen-com#7350 (onProgress
only), heygen-com#7352, heygen-com#7348, heygen-com#7344, heygen-com#7353, heygen-com#7356 and heygen-com#7355. Defer heygen-com#5708 (needs heygen-com#6911) and
heygen-com#7345 (READ_VERSION 4 vs 7); heygen-com#7307 not applicable. Re-read 14 moved pins, pin 6
new PRs (monitored 126). Make checkReportFile module-private and suppress the
cross-package closeTestChrome duplicate for fallow.

Co-authored-by: Miguel Ángel <[email protected]>
Co-authored-by: SophiaHuangCc <[email protected]>
Co-authored-by: Dante <[email protected]>
Co-authored-by: Muzzy5150 <[email protected]>
Co-authored-by: ump45nose <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant