Repository navigation
feat: phrase-word dictionary linking for conversations - #27
Merged
Merged
Conversation
Implement word-to-dictionary matching in conversation phrases: - Add phraseWordMatcher.ts: Longest-match algorithm for Japanese text * buildWordIndex(): Create Map-based dictionary index (kanji/hiragana keys) * matchPhraseWords(): Match dictionary words in phrase without spacing * segmentPhrasedText(): Split text into linked + plain segments * Full test suite covering edge cases (overlaps, consecutive matches, skips) - Add LinkedPhrase component: Interactive word linking UI * Display dictionary words as clickable chips with romaji * Bottom sheet with word details (kanji, hiragana, romaji, meaning, level, example) * "Add to memo" button with immediate store update * "Already saved" state indication with Check icon - Update ConversationDetailPage: Replace ClickablePhrase with LinkedPhrase * Full integration with Zustand conversation memo store * Offline-ready: Uses bundled WORDS dictionary * Toast feedback for add/remove actions Test results: 122/122 passed Build: ✓ (no type errors, production ready) Lint: ✓ (ESLint clean) Scope: Conversation phrases without inflection variants (future work).
수정 사항:
- categoryId를 props로 받아 메모 저장 시 올바른 카테고리 기록
- 단어 추가 시 bumpMissionProgress('conversation', 1) 호출해 미션 진행도 업데이트
- phrase.words의 isParticle 필드 활용해 입자 판정 정확도 개선
(기존: 1글자 비한자 추측, 새: 원본 표현 데이터 기준)
- 접근성: Esc 키로 바텀시트 닫기, 포커스 관리, aria-label 추가
- 문구 개선: "조사는 단어장에 담을 수 없어요" (기존 "입자는")
- 제거 시 toast 레벨 일관성: info (success 대신)
모든 테스트 122개, 린트, 빌드 통과.
렌더마다 matchPhraseWithWords를 호출하면 buildWordIndex를 재생성해 불필요한 계산이 반복된다. phrase.japanese가 변경될 때만 재계산하도록 최적화. 모든 테스트 122개, 린트, 빌드 통과.
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.
Summary
Implement word-to-dictionary matching in conversation phrases with interactive UI for learning.
Features:
Verification
Fixes in review
Limitations
🤖 Generated with Claude Code