-
Notifications
You must be signed in to change notification settings - Fork 2
'조'가 섹션헤더로 잡히지 않고 '관'만 섹션헤더로 잡히는 경우 비정상적으로 긴 청크가 생성되는 것 방지. #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary of ChangesHello @inoray, 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! 이 풀 리퀘스트는 문서 전처리기가 섹션 헤더의 잘못된 병합으로 인해 과도하게 긴 문서 청크를 생성할 수 있는 문제를 해결합니다. "제x장/절/관" 유형 헤더를 병합하기 위한 보다 정확한 조건을 도입하여 적절하고 짧은 단일 항목 섹션만 병합되도록 함으로써 문서 분할의 정확성과 구조를 개선합니다. Highlights
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
이 PR은 '조'가 섹션 헤더로 인식되지 않고 '관'만 헤더로 잡힐 때, 내용이 있는 섹션이 불필요하게 병합되어 비정상적으로 긴 청크가 생성되는 문제를 해결합니다. 변경 사항은 intelligent_processor_law.py와 레거시 파일인 적재용(규정)v2.py에 동일하게 적용되었습니다. 섹션을 병합하기 전에 아이템 개수가 1개인지, 그리고 해당 아이템의 텍스트 길이가 30자를 초과하지 않는지 확인하는 로직을 추가하여 문제를 해결했습니다. 로직은 타당해 보입니다. 다만, 코드의 유지보수성을 높이기 위해 매직 넘버 30을 클래스 상수로 정의하는 것을 제안합니다.
| if re.match(r"제\s*\d+\s*(장|절|관)", text): | ||
| # 문단이 이미 구성된 것은 제외 | ||
| item_text = "".join(item.text for item in items if hasattr(item, "text")) | ||
| if len(item_text) > 30: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
하드코딩된 숫자 30은 코드의 의도를 파악하기 어렵게 만들고 향후 유지보수를 어렵게 할 수 있습니다. 이 값을 HybridChunker 클래스의 속성으로 추출하여 명확한 이름을 부여하는 것이 좋습니다.
예를 들어, HybridChunker 클래스에 다음과 같이 상수를 추가할 수 있습니다:
class HybridChunker(BaseChunker):
...
_MIN_TEXT_LENGTH_FOR_SEPARATE_SECTION: int = 30
...그런 다음 이 상수를 사용하여 코드를 더 명확하게 만들 수 있습니다.
| if len(item_text) > 30: | |
| if len(item_text) > self._MIN_TEXT_LENGTH_FOR_SEPARATE_SECTION: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
하드코딩된 숫자 30은 코드의 의도를 파악하기 어렵게 만들고 향후 유지보수를 어렵게 할 수 있습니다. 이 값을 HybridChunker 클래스의 속성으로 추출하여 명확한 이름을 부여하는 것이 좋습니다.
예를 들어, HybridChunker 클래스에 다음과 같이 상수를 추가할 수 있습니다:
class HybridChunker(BaseChunker):
...
_MIN_TEXT_LENGTH_FOR_SEPARATE_SECTION: int = 30
...그런 다음 이 상수를 사용하여 코드를 더 명확하게 만들 수 있습니다.
| if len(item_text) > 30: | |
| if len(item_text) > self._MIN_TEXT_LENGTH_FOR_SEPARATE_SECTION: |
Checklist: