Skip to content

fix(word): calculate_branching_entropy max() 빈 시퀀스 방어 가드 추가#311

Merged
lovit merged 1 commit intorefactor-2026from
feature/308
Mar 10, 2026
Merged

fix(word): calculate_branching_entropy max() 빈 시퀀스 방어 가드 추가#311
lovit merged 1 commit intorefactor-2026from
feature/308

Conversation

@lovit
Copy link
Copy Markdown
Owner

@lovit lovit commented Mar 10, 2026

Summary

calculate_branching_entropy_accessor_variety_batch 함수에서 L 또는 R이 비어 있을 때 max(l_groupby_len) 호출로 ValueError 발생 가능.

max(l_groupby_len, default=0) 패턴으로 수정해 빈 입력 시 안전하게 동작하도록 개선.

관련 이슈

Close #308

Test plan

  • uv run pyright soynlp/word/ — 0 errors
  • uv run pytest tests/unit/test_wordextractor.py — 19 passed

L 또는 R 빈도 맵이 비어 있을 경우 max() 호출 시 ValueError가 발생할 수 있어
max(iterable, default=0) 패턴으로 수정

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lovit lovit merged commit 13028c6 into refactor-2026 Mar 10, 2026
1 of 2 checks passed
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.

1 participant