[HCR-226] 회원별 키워드 집계기(Aggregator) 구현 및 추출 파이프라인(Stage 2, 3) 정확도 개선#14
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 Pull Request는 키워드 추출 파이프라인의 정확성을 높이고 사용자별 키워드 사용 통계를 효율적으로 집계하기 위한 개선 사항을 포함합니다. 기존의 중복 카운팅 버그를 수정하고, 오타 교정 알고리즘의 탐지율을 향상시켰으며, 여러 분석 결과를 회원 ID 기준으로 통합하는 새로운 집계 모듈을 도입하여 데이터 처리의 신뢰성과 유용성을 증대시켰습니다. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This PR aims to add member-based keyword aggregation and improve the accuracy of the existing analysis pipeline. The implementation includes a new aggregator.py for merging distributed result files and fixes a duplicate count bug in extractor.py, along with thorough E2E and unit testing. However, it's critical to address a security and privacy risk: several debug print statements in app/pipeline/scorer.py are logging customer input text, which likely contains Personally Identifiable Information (PII). These must be removed before merging. Additionally, consider improving code robustness and maintainability by standardizing logging, strengthening exception handling, and adopting a more concise code style.
📝작업 내용
1. Aho-Corasick 오토마톤 중복 매핑 버그 수정 (Stage 2)
keyword_id가 중복으로 등록되어 카운트가 2배로 집계되는 버그를 수정했습니다.2. 회원(member_id) 기준 분석 결과 집계기 구현 (
aggregator.py)분산된 여러 청크 파일(
chunk-*.mapping.jsonl.gz)을 읽어들여,member_id기준으로 키워드 출현 횟수를 누적(+) 합산하는 로직을 추가했습니다.백엔드(Spring) 배치에서 바로 읽어갈 수 있도록 최종 결과를 단일 파일(
aggregated_summary.json)로 원자적 저장합니다.3. 오타 교정(Fallback) 알고리즘 고도화 (Stage 3)
4. 파이프라인 통합 E2E 테스트 검증 완료
👀변경 사항
app/pipeline/extractor.py: 오토마톤 트리에 단어를 추가하는_add_to_automaton()내부에 동일keyword_id중복 검증 방어 로직이 추가되었습니다.app/pipeline/scorer.py: 다메라우 연산을 위한 명사 추출 로직 변경형태소 분석 허용 범위를 대폭 확대했습니다. (
NOUN,PROPN➔ADV,SCONJ,X,VERB,ADJ추가)과도하게 단어가 뭉치는 것을 방지하기 위해 띄어쓰기(
token.whitespace_)를 기준으로 검사 덩어리를 분리하도록 수정했습니다.app/pipeline/aggregator.py:ResultAggregator클래스를 통해 Job 단위의 최종 통계를 산출합니다.tests/test_e2e.py: Stage 3(다메라우 연산)의 완벽한 테스트 커버리지를 위해 Mock 데이터의 구조를 일부 변경하고(의도적인 미등록 오타 주입), Analyze -> Aggregator로 이어지는 연속 실행 검증 로직을 추가했습니다.🎫 Jira Ticket
#️⃣관련 이슈