From c528b965cb31f7304312b33b19a9e05c3c38fcfb Mon Sep 17 00:00:00 2001 From: happybell80 Date: Tue, 9 Sep 2025 20:46:41 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20=EC=8B=9C=EA=B0=84=20=EC=9D=B8=EC=8B=9D?= =?UTF-8?q?=20=EC=9D=98=EB=8F=84=20=EC=B2=98=EB=A6=AC=20=EC=84=B9=EC=85=98?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=20(3.4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 실제 대화 로그 분석 결과 반영 (2025-09-09) - 시간 인식 실패 사례 ("오늘은 2024년" 오류) - 3가지 시급 시나리오: 시간 질문, 맥락 참조, 감정 피드백 - Snips + Self-Attentive Gate 통합 코드 예시 - TimeAwareIntentClassifier 구현 방안 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- ...형_점진적_의도_구축_시스템.md | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/ideas/250819_대화형_점진적_의도_구축_시스템.md b/ideas/250819_대화형_점진적_의도_구축_시스템.md index 03627ef..57715be 100644 --- a/ideas/250819_대화형_점진적_의도_구축_시스템.md +++ b/ideas/250819_대화형_점진적_의도_구축_시스템.md @@ -212,6 +212,89 @@ flowchart TD --- +## 3.4 시간 인식 의도 처리 (신규 추가 2025-09-09) + +### 3.4.1 실제 대화 로그 분석 결과 +2025년 9월 9일 PostgreSQL conversation_logs 테이블 분석 결과, 로빙의 가장 심각한 문제는 **시간 인식 부재**입니다. + +``` +실제 사례: +사용자: "오늘 몇일이야?" +로빙: "오늘은 2024년 5월 16일 목요일입니다" ❌ (실제: 2025년 9월 9일) +``` + +### 3.4.2 시급한 의도 파악 시나리오 + +#### 시나리오 1: 시간 질문 의도 +```python +TIME_QUERY_PATTERNS = { + "absolute_time": r"몇시|몇일|무슨요일|오늘|내일", + "relative_time": r"어제|아까|방금|조금전", + "time_reference": r"그때|언제|며칠" +} + +# 의도 분류 시 시간 컨텍스트 필수 주입 +if any(pattern in text for pattern in TIME_QUERY_PATTERNS.values()): + context["current_time"] = datetime.now(KST).strftime("%Y년 %m월 %d일 %H:%M") + context["needs_time"] = True +``` + +#### 시나리오 2: 맥락 참조 의도 +```python +CONTEXT_RETRIEVAL_PATTERNS = { + "past_reference": r"어제.*했|아까.*말한|그때.*것", + "modification": r"바꿔|수정|변경|취소" +} + +# DB에서 과거 대화 조회 필수 +if pattern_matches(CONTEXT_RETRIEVAL_PATTERNS): + past_logs = await fetch_conversation_logs( + user_id=user_id, + time_range="-2 hours", + limit=5 + ) + context["past_context"] = past_logs +``` + +#### 시나리오 3: 감정적 피드백 의도 +```python +NEGATIVE_FEEDBACK_PATTERNS = { + "frustration": r"모르는구나|답답|짜증", + "correction": r"아니야|틀렸어|다시", + "sarcasm": r"그래그래|알았어알았어" +} + +# 부정 피드백 감지 시 시스템 점검 +if pattern_matches(NEGATIVE_FEEDBACK_PATTERNS): + log_system_error("User frustration detected") + return apologize_and_clarify() +``` + +### 3.4.3 Snips + Self-Attentive Gate 통합 +```python +class TimeAwareIntentClassifier: + def __init__(self): + self.snips = SnipsNLU() # 경량 의도 분류 + self.gate = SelfAttentiveGate() # 시간 게이트 + + async def classify_with_time(self, text, user_id): + # Step 1: Snips로 빠른 의도 분류 (50ms) + intent = self.snips.classify(text) + + # Step 2: Gate로 시간 필요 여부 결정 (10ms) + needs_time = self.gate.needs_temporal_context(intent) + + # Step 3: 선택적 시간 컨텍스트 추가 + if needs_time: + context = await self.enrich_temporal_context(text, user_id) + else: + context = {} + + return {"intent": intent, "context": context} +``` + +--- + ## 4. 데이터 구조 ### 4.1 컨텍스트 스키마