HWPX 수식 스크립트 토큰 처리 — root/sqrt glued, rm+bar, prime glued (closes #1204)#1208
Merged
Merged
Conversation
7ca8b60 to
51dca12
Compare
여러 시험지 HWPX(3-09월/3-11월_*_2022)에서 일부 수식이 렌더 안 되고
스크립트 토큰이 literal 텍스트로 leak.
- A: root/sqrt + 관계연산자(GEQ/LEQ/GE/LE) 가 숫자에 붙음(`root3`,`GEQ5`) → digit-guard 분리.
- B: parser.parse_single_or_group 이 symbol/function 외 명령을 Text 처리해
`rm` body 의 `bar` leak → parse_command 재귀 위임.
- C: prime 이 글자에 붙음(`primeF`) → alnum-guard 분리.
- D: DECORATIONS/FONT_STYLES lookup 대소문자 구분 → 대문자 명령(`RM`) 소문자 fallback
+ tokenizer 에 RM/IT/BOLD 추가.
- E: 키워드가 글자에 붙음(`tanx`,`barMH`,`LEQb`,`trianglePQR`,`rmbarFF`,`capB`)
→ glued run 에서 allowlist 키워드 최장 prefix 분리 (함수/장식/관계/도형/집합).
over-split 가드: greek/root/arg 제외 (alphabet·rootn·argmax 유지, edwardkim#576).
- F: over/atop 가 짧은(≤2자) 글자 분모에 붙음(`overa^2`,`overdx`) → 분리(분수).
긴 word(overlap)·keyword(overline/overset)는 유지 → edwardkim#1122 보존.
- 회귀 테스트 9건 (split 케이스 + over-split 가드)
- 검증: 09월(2207)+11월(1723) 전 스크립트 sweep leak 0, 양 파일 시각 정합
(09월 문15-26·21쪽 / 11월 14쪽 ∩∪·19쪽 분수·21쪽 overline/△/∠), 전체 1902 통과
closes edwardkim#1204
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
51dca12 to
b5742bc
Compare
edwardkim
added a commit
that referenced
this pull request
Jun 1, 2026
작업지시자 지적 — cdotscdots(⋯⋯, 생략기호 연접)가 PR #1208 보정 후에도 leak. PR 의 GLUE_SAFE allowlist 에 dots 계열 미포함이 원인(lookup_symbol 은 대소문자 무시라 cdots 단독은 이미 ⋯ 인식, 연접만 미분리). - GLUE_SAFE 에 cdots/ldots/vdots/ddots 추가(5자 명시만, 모호 4자 dots 제외). - test_dots_glued_split 추가. - cdotscdots 14·18·19·20쪽 → 0, ⋯ 정상 렌더. test --tests 1907 passed. - pr_1208_review.md / pr_1208_report.md / orders 갱신. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Owner
|
머지했습니다(devel 20쪽 등의 수식 leak(root3/rm bar/primeF)이 정상 렌더로 전환됨을 실문서 23페이지 정량 비교로 확인했습니다(변화한 13페이지 모두 leak→정상, 오분리 회귀 0). GLUE_SAFE allowlist 로 분리 대상을 명시 제한하고 whole-keyword/longest-match 가드를 둔 설계가 견고했습니다. 두 가지 참고:
전체 테스트 1907 passed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
문제 (closes #1204)
samples/3-09월_교육_통합_2022.hwpx20쪽 등에서 일부 수식이 렌더되지 않고 스크립트 토큰이 literal 텍스트로 leak (문15·24·25·26·30). 전체 수식 2207개 중 일부.근본 원인 (실제 스크립트로 확정)
tokenizerglued-keyword 분리 목록에root/sqrt미포함 →root3한 토큰 → "root3" leak (√3 이어야 함)parser.parse_single_or_group가 symbol/function 외 명령을Text처리 →rmbody 의bar(overline) leakprime이 글자에 붙으면(primeF) 미분리 → leak수정 (
src/renderer/equation/)tokenizer.rs—root/sqrt(+대문자) 가 숫자에 붙으면 분리 (over/atop digit-guard 패턴 차용 — letter 변수 충돌/Task [m100] exam_science.hwp 20번 응답 수식 (timesm / simZ) — 수식 토크나이저 keyword prefix-split 누락 #576 회귀 위험 회피).parser.rs—parse_single_or_group의 Command 분기를parse_command재귀로 (fall-through 가 미지 명령을 Text 처리하므로 안전, decoration/구조 명령 정상화).tokenizer.rs—prime(+대문자) 가 alnum 에 붙으면 분리.모델/레이아웃/타 모듈 무변경.
검증
cargo test --release전체 1897 passed, 0 failed (수식 회귀 테스트 4건 추가).root37→0,bar5→0,prime→0.예시 (수정 후)
root3 y→ √3·yrm bar {F prime F}→ overline(F′F)bar {F primeF}→ F′F