Skip to content

[MESP-247] [MESP-144] [STORY] 단어 수집 & Vocabulary 연동 구현 #472

Description

@DDINGJOO

배경

뉴스에서 모르는 단어를 클릭하여 수집하고, 기존 Vocabulary 도메인과 연동하여 통합 학습이 가능하도록 합니다. 단어 하이라이트 기능으로 난이도 높은 단어를 시각적으로 표시합니다.

수용 기준(AC)

  • NewsWordCollect 모델 클래스 생성
  • 단어 수집 API (POST /news/{articleId}/words)
  • 수집 단어 목록 API (GET /news/words)
  • Vocabulary 연동 API (POST /news/words/{word}/sync)
  • 단어 하이라이트 로직 구현 (사용자 레벨 기준)
  • 단어 뜻/예문 조회 API (GET /news/{articleId}/words/{word})
  • NewsWordCollectRepository CRUD 구현

디자인/계약 링크

단어 하이라이트 로직:

1. 사용자 레벨 확인 (BEGINNER/INTERMEDIATE/ADVANCED)
2. 기사 내 keywords에서 사용자 레벨보다 높은 단어 추출
3. 해당 단어들에 highlightWords 필드로 마킹
4. 프론트엔드에서 하이라이트 렌더링

DynamoDB 스키마 - NewsWordCollect:

PK: USER#{userId}#NEWS
SK: WORD#{word}#{articleId}
GSI1-PK: USER#{userId}#NEWS_WORDS
GSI1-SK: {collectedAt}

Attributes:
- word, meaning, context (문맥 문장)
- articleId (출처), collectedAt
- syncedToVocab (Boolean), vocabUserWordId

Vocabulary 연동 흐름:

NewsWordCollect → UserWord (source: "NEWS")
                  ├─ sourceId: articleId
                  └─ context: 원문 문맥

API Request - POST /news/{articleId}/words:

{
  "word": "revenue",
  "context": "The company's revenue increased by 20%."
}

API Response - GET /news/{articleId}/words/{word}:

{
  "word": "revenue",
  "meaning": "수익, 매출",
  "pronunciation": "/ˈrevənjuː/",
  "examples": ["Annual revenue exceeded expectations."],
  "level": "INTERMEDIATE",
  "audioUrl": "https://..."
}

구현 메모/리스크

  • 기존 Word 테이블과 매칭 시도, 없으면 Bedrock으로 생성
  • Vocabulary UserWord 생성 시 source="NEWS" 명시
  • 단어 뜻은 캐싱하여 반복 조회 비용 절감

연결된 Epic

#384

Metadata

Metadata

Assignees

No one assigned

    Labels

    storyUser story

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions