Skip to content

Conversation

@inoray
Copy link
Collaborator

@inoray inoray commented Nov 18, 2025

Checklist:

  • Documentation has been updated, if necessary.
  • Examples have been added, if necessary.
  • Tests have been added, if necessary.

@gemini-code-assist
Copy link

Summary of Changes

Hello @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

  • 섹션 병합 로직 개선: 비정상적으로 긴 문서 청크 생성을 방지하기 위해 섹션 병합 로직을 개선했습니다.
  • 단일 항목 섹션 검사 추가: 다음 섹션과 병합할 섹션에 대해 단일 항목 섹션만 고려하도록 검사를 추가했습니다.
  • 길이 기반 병합 필터 도입: 텍스트 내용이 상당한 길이(30자 초과)인 섹션의 병합을 방지하기 위해 길이 기반 필터를 추가하여 짧고 헤더만 있는 섹션만 병합되도록 했습니다.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

하드코딩된 숫자 30은 코드의 의도를 파악하기 어렵게 만들고 향후 유지보수를 어렵게 할 수 있습니다. 이 값을 HybridChunker 클래스의 속성으로 추출하여 명확한 이름을 부여하는 것이 좋습니다.

예를 들어, HybridChunker 클래스에 다음과 같이 상수를 추가할 수 있습니다:

class HybridChunker(BaseChunker):
    ...
    _MIN_TEXT_LENGTH_FOR_SEPARATE_SECTION: int = 30
    ...

그런 다음 이 상수를 사용하여 코드를 더 명확하게 만들 수 있습니다.

Suggested change
if len(item_text) > 30:
if len(item_text) > self._MIN_TEXT_LENGTH_FOR_SEPARATE_SECTION:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

하드코딩된 숫자 30은 코드의 의도를 파악하기 어렵게 만들고 향후 유지보수를 어렵게 할 수 있습니다. 이 값을 HybridChunker 클래스의 속성으로 추출하여 명확한 이름을 부여하는 것이 좋습니다.

예를 들어, HybridChunker 클래스에 다음과 같이 상수를 추가할 수 있습니다:

class HybridChunker(BaseChunker):
    ...
    _MIN_TEXT_LENGTH_FOR_SEPARATE_SECTION: int = 30
    ...

그런 다음 이 상수를 사용하여 코드를 더 명확하게 만들 수 있습니다.

Suggested change
if len(item_text) > 30:
if len(item_text) > self._MIN_TEXT_LENGTH_FOR_SEPARATE_SECTION:

@inoray inoray requested a review from JaeseungYang November 19, 2025 00:55
@inoray inoray merged commit 6853021 into develop Nov 19, 2025
2 checks passed
@inoray inoray deleted the bug/117-big_chunk branch November 19, 2025 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

약관문서에서 '조'가 섹션헤더로 잡히지 않을 때 비정상적인 크기의 청크가 생성되는 버그

3 participants