Skip to content

feat: 역점역(점자→한글) 기능 구현 및 점자 입력 키보드 추가 - #1

Merged
coom1222 merged 7 commits into
coom1222:demo-ios-appfrom
jessieyeon:demo-ios-app
May 31, 2026
Merged

feat: 역점역(점자→한글) 기능 구현 및 점자 입력 키보드 추가#1
coom1222 merged 7 commits into
coom1222:demo-ios-appfrom
jessieyeon:demo-ios-app

Conversation

@jessieyeon

Copy link
Copy Markdown

Rust 디코더

  • libs/braillify/src/decoder.rs 신규 작성
    • 한국 점자 → 한글 상태 머신 디코더 (Start / GotCho / GotJung)
    • 약자(을·억·언·얼·연·열·영·옥·온·옹·운·울·은·인) 디코딩
    • 2바이트 특수 약자(성·정·청·것) 디코딩
    • 가나다마바사자카타파하 초성 단독 약자 디코딩
    • Unicode TIndex 종성 값 정확히 반영 (ㄹ=8, ㅇ=21 등)
    • 7개 단위 테스트 전체 통과
  • libs/braillify/src/lib.rs: pub fn decode() 공개 함수 추가

WASM 바인딩

  • packages/node/src/lib.rs: decodeFromUnicode() JS 함수 노출

모바일 앱 UI

  • apps/mobile/src/lib/translate.ts
    • translateReverse() 구현 — decodeFromUnicode WASM 연결
  • apps/mobile/src/pages/TranslatorPage.tsx
    • 정점역 / 역점역 방향 토글 추가
    • 역점역 모드에서 BrailleInput 컴포넌트로 전환
  • apps/mobile/src/components/BrailleInput.tsx 신규 작성
    • 직접 입력/붙여넣기 텍스트 필드 (점자 유니코드)
    • 도트 키보드: EditableBrailleCell 재사용, 셀 단위 점 토글
    • 두 입력 방식 실시간 동기화 (masksToString / parseToCells)

테스트 방법

  1. cargo test -p braillify decoder — 7개 단위 테스트 통과 확인
  2. 앱에서 "역점역" 탭 전환
  3. ⠈⠎⠐⠕ 붙여넣기 → "거리" 출력 확인
  4. 도트 키보드로 셀 직접 조합 후 역점역하기 버튼 클릭

미구현 범위

  • 숫자 점자(#...) 디코딩
  • 영문 점자 디코딩
  • 낱말 약자(그래서·하지만 등) 디코딩

## Rust 디코더
- `libs/braillify/src/decoder.rs` 신규 작성
  - 한국 점자 → 한글 상태 머신 디코더 (`Start / GotCho / GotJung`)
  - 약자(을·억·언·얼·연·열·영·옥·온·옹·운·울·은·인) 디코딩
  - 2바이트 특수 약자(성·정·청·것) 디코딩
  - 가나다마바사자카타파하 초성 단독 약자 디코딩
  - Unicode TIndex 종성 값 정확히 반영 (ㄹ=8, ㅇ=21 등)
  - 7개 단위 테스트 전체 통과
- `libs/braillify/src/lib.rs`: `pub fn decode()` 공개 함수 추가

## WASM 바인딩
- `packages/node/src/lib.rs`: `decodeFromUnicode()` JS 함수 노출

## 모바일 앱 UI
- `apps/mobile/src/lib/translate.ts`
  - `translateReverse()` 구현 — `decodeFromUnicode` WASM 연결
- `apps/mobile/src/pages/TranslatorPage.tsx`
  - 정점역 / 역점역 방향 토글 추가
  - 역점역 모드에서 `BrailleInput` 컴포넌트로 전환
- `apps/mobile/src/components/BrailleInput.tsx` 신규 작성
  - 직접 입력/붙여넣기 텍스트 필드 (점자 유니코드)
  - 도트 키보드: `EditableBrailleCell` 재사용, 셀 단위 점 토글
  - 두 입력 방식 실시간 동기화 (`masksToString` / `parseToCells`)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces reverse translation (Braille to Korean) capabilities, including a new BrailleInput component for the mobile app and a Rust-based Korean braille decoder. Feedback on these changes highlights a critical issue where tense consonants (double consonants) are not correctly decoded, which can be resolved by implementing a double-consonant parsing helper and adding corresponding unit tests. Additionally, the reviewer recommended mapping regular spaces and newlines to braille spaces during pasting to preserve word boundaries, and replacing array indices with stable keys in the React component to avoid rendering bugs.

Comment thread libs/braillify/src/decoder.rs
Comment thread apps/mobile/src/components/BrailleInput.tsx
Comment thread libs/braillify/src/decoder.rs Outdated
Comment thread libs/braillify/src/decoder.rs Outdated
Comment thread libs/braillify/src/decoder.rs
Comment thread apps/mobile/src/components/BrailleInput.tsx
Comment thread apps/mobile/src/pages/TranslatorPage.tsx
yeoneunseo and others added 6 commits May 31, 2026 21:18
PR 리뷰 피드백 반영 (gemini-code-assist Critical).

된소리표 ⠠(32) 뒤의 바이트 패턴이 두 가지임을 확인:
- ㅏ 모음: 된소리표 + 약자/공유 바이트 (까=[32,43], 싸=[32,7])
- 기타 모음: 된소리표 + 초성 바이트 + 별도 중성 (꺼=[32,8,14], 쏘=[32,32,37])

try_choseong_with_double() 함수 추가:
  43|8  → ㄲ(1)  / 10 → ㄸ(4)  / 24 → ㅃ(8)
  7|32  → ㅆ(10) / 40 → ㅉ(13)

Stage::Start, Stage::GotJung 두 곳에서 try_choseong → try_choseong_with_double 교체.
된소리 테스트 8개 추가 (ㅏ 모음 5종 + ㅏ 외 모음 3종 + 단어 2종).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PR 리뷰 피드백 반영 (gemini-code-assist High Priority).

붙여넣기 시 일반 공백(' ')과 줄바꿈('\n')이 무시되어
단어 경계가 사라지는 문제 수정.
→ 두 문자 모두 0(⠀ U+2800 점자 공백)으로 매핑하여 단어 경계 보존.
PR 리뷰 피드백 반영 (gemini-code-assist Medium Priority).

단음절 테스트만으로는 놓칠 수 있는 케이스를 보완:
- 껐어요: 된소리 + 종성 + 후속 음절
- 아까: 단어 중간에 된소리
- 기쁘다: ㅃ(된소리ㅂ) 포함 단어
PR 리뷰 피드백 반영 (gemini-code-assist Medium Priority).

배열 인덱스를 key로 쓰면 셀 삭제 시 React가 잘못된
컴포넌트를 재사용하는 버그가 생길 수 있음.
counter useRef로 단조 증가 ID를 생성하고 cellIds state에 저장.
- 셀 추가/공백/삭제 시 ID 배열도 함께 업데이트
- 텍스트 붙여넣기로 전체 교체 시 모든 셀에 새 ID 발급
- 방향 전환 등 외부 초기화(cells.length===0) 시 useEffect로 동기화
리뷰어(Nohgh) 피드백 반영.

기존: direction(정점역/역점역) + mode(일반/수학) 두 개의 토글
변경: PageMode('general'|'math'|'reverse') 단일 상태로 통합
→ [일반] [수학] [역점역] 한 줄 토글로 3가지 기능이 명확하게 표시됨

- direction/mode 두 상태 제거, pageMode 하나로 대체
- 수학 점역 기능 유지 확인
@coom1222
coom1222 merged commit 34894a4 into coom1222:demo-ios-app May 31, 2026
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.

4 participants