Skip to content

Add Match::joinEp to join prefinal endings into the verb stem - #279

Open
heeoneie wants to merge 2 commits into
bab2min:mainfrom
heeoneie:feat/issue163-join-ep
Open

heeoneie wants to merge 2 commits into
bab2min:mainfrom
heeoneie:feat/issue163-join-ep

Conversation

@heeoneie

@heeoneie heeoneie commented Sep 22, 2026 •

Copy link
Copy Markdown

#163 구현입니다. 이슈에 남겨주신 대로 Match에 비트 플래그 joinEp를 추가하고
joinAffixTokens에 결합 로직만 넣었습니다.

사양

원 요청(bab2min/kiwipiepy 토론 #165)에서 확인해주신 형태를 그대로 따랐습니다.

들어가/VV + 시/EP + ᆫ다/EF   →   들어가시/VV + ᆫ다/EF

결합 규칙

(V. | XSV | XSA) + EP 와 EP + EP를 왼쪽 태그를 유지한 채 합칩니다. 왼쪽 조건은
isVerbClass(VV, VA, VX, VCP, VCN, XSV, XSA)를 그대로 썼습니다.

입력 Match::none Match::joinEp
들어가신다 들어가/VV, 시/EP, ᆫ다/EF 들어가시/VV, ᆫ다/EF
드셨겠더라 드시/VV, 었/EP, 겠/EP, 더라/EF 드시었겠/VV, 더라/EF
예쁘시겠어요 예쁘/VA, 시/EP, 겠/EP, 어요/EF 예쁘시겠/VA, 어요/EF
아니셨다 아니/VCN, 시/EP, 었/EP, 다/EF 아니시었/VCN, 다/EF
공부하셨다 공부/NNG, 하/XSV, 시/EP, 었/EP, 다/EF 공부/NNG, 하시었/XSV, 다/EF

파생 용언의 어간을 하나로 만들려면 기존 joinVerbSuffix를 함께 켜면 됩니다
(공부하셨다 → 공부하시었/VV + 다/EF). 두 플래그의 역할이 나뉘어 있어 따로
두었는데, joinEp 하나만으로 공부하시었/VV까지 만들어지는 편이 낫다면 그렇게
바꾸겠습니다.

범위

  • 새 플래그는 joinAffix에도 all에도 넣지 않았습니다. 켜지 않으면 기존 동작이
    그대로입니다.
  • joinParticleYo와 동일하게 C API(KIWI_MATCH_JOIN_EP), Java, Swift, WASM
    바인딩의 상수도 함께 추가했습니다. 비트는 비어 있던 1 << 28입니다.
  • 파이썬(kiwipiepy) 쪽 미러는 저장소가 달라 이 PR에는 넣지 않았습니다. 이 PR이
    반영되면 그쪽에도 올리겠습니다.

테스트

  • TEST(KiwiCpp, JoinEp)을 추가했습니다. 위 표의 경우들과, 플래그를 켜지 않았을
    때 기존 분석 결과가 유지되는지를 함께 확인합니다.
  • 결합 로직만 되돌리면 이 테스트는 12개 단언에서 실패합니다.
  • macOS(arm64, AppleClang) Release 빌드에서 kiwi-test 전체를 돌렸습니다.
    기존 163개 통과 → 신규 1개 포함 164개 전부 통과.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added a joinEp matching option across supported APIs.
    • Enables prefinal endings to be joined with preceding verb, adjective, and copula stems during morphological matching.
    • Supports combining with verb-suffix joining for fully merged derived verbs.
  • Tests

    • Added coverage for single and multiple prefinal endings across supported word types.

heeoneie and others added 2 commits September 22, 2026 15:11
Requested in bab2min#163: analyze `들어가신다` as `들어가시/VV` + `ㄴ다/EF` instead of
`들어가/VV` + `시/EP` + `ㄴ다/EF`, so that only the final ending is separated
from the stem.

This follows the note on the issue: a new bit flag and the joining logic in
`joinAffixTokens`.  The left side accepts every tag `isVerbClass` covers
(VV, VA, VX, VCP, VCN, XSV, XSA) and EP itself, so a chain of prefinal
endings collapses into the stem as well (`드시/VV` + `었/EP` + `겠/EP` =>
`드시었겠/VV`).  A derived stem still needs `joinVerbSuffix` to become one
token, which is what that flag is for.

The new flag is not part of `joinAffix` or `all`, so nothing changes unless
it is asked for.  It is mirrored in the C, Java, Swift and WASM bindings the
way `joinParticleYo` is.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The test covers a single prefinal ending, a chain of two, adjectives and the
negative copula, and a derived stem with and without `joinVerbSuffix`.  It
also pins the analysis without the flag, so that turning it off keeps the
current output.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: de114d09-c34c-45a2-8d01-97a3bfdc8b01

📥 Commits

Reviewing files that changed from the base of the PR and between 280302a and b282e5b.

📒 Files selected for processing (7)
  • bindings/java/src/kr/pe/bab2min/Kiwi.java
  • bindings/swift/Sources/Kiwi/MatchOptions.swift
  • bindings/wasm/package/src/kiwi.ts
  • include/kiwi/PatternMatcher.h
  • include/kiwi/capi.h
  • src/Kiwi.cpp
  • test/test_cpp.cpp

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The PR adds the joinEp matching option to the C++, C, Java, Swift, and WebAssembly APIs. When enabled, joinAffixTokens joins pre-final ending tokens to eligible preceding tokens. C++ tests cover the new behavior.

Changes

joinEp matching

Layer / File(s) Summary
Public matching option
include/kiwi/PatternMatcher.h, include/kiwi/capi.h, bindings/java/..., bindings/swift/..., bindings/wasm/...
The public APIs define joinEp with bit value 1 << 28.
EP token joining and tests
src/Kiwi.cpp, test/test_cpp.cpp
joinAffixTokens joins EP tokens to eligible verb-class or EP tokens when Match::joinEp is enabled. Tests cover multiple endings and combined joinVerbSuffix behavior.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: bab2min

Merge Risk: ⚪ Minimal · up to b282e

The new opt-in option joins prefinal endings while preserving existing defaults, with consistent API exposure and focused coverage. No current merge-blocking risk is evidenced.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding the Match::joinEp flag to join prefinal endings into the verb stem.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@heeoneie

Copy link
Copy Markdown
Author

@bab2min 안녕하세요. 리뷰 재촉은 아니고, 이 PR의 워크플로가 실행 승인 대기 상태로 멈춰 있어서 알려드립니다.

현재 head(b282e5b)의 워크플로 8개(Ubuntu, Windows, macOS, Centos7, Arm64-Centos7, WASM Bindings, Swift Bindings, Doxygen publish)가 전부 action_required로 남아 있습니다. 포크에서 올린 PR이라 메인테이너가 실행을 승인해주셔야 도는 것으로 보입니다. 그래서 이 PR은 아직 CI가 한 번도 돌지 않았고, 상태도 unstable로 표시됩니다.

같은 날 올린 #278은 승인이 되어 7종 전부 통과했는데, 이 PR만 누락된 것 같습니다.

test/test_cpp.cpp에 Match::joinEp 테스트를 44줄 추가해 두었으니, 승인만 해주시면 바인딩 5종 빌드까지 같이 확인됩니다. 제 쪽 로컬에서는 kiwi-test 전체가 통과하는 것을 확인했습니다.

번거로우시겠지만 확인 부탁드립니다.

@heeoneie

Copy link
Copy Markdown
Author

@bab2min 안녕하세요. 시간 되실 때 리뷰 부탁드립니다.

현재 head(b282e5b)에서 CI가 전부 통과했고 main과 충돌도 없습니다. 고칠 부분이 있으면 말씀 주세요. 머지되면 kiwipiepy에 Match.JOIN_EP 미러를 추가하는 PR을 이어서 올리겠습니다.

This branch has not been deployed

No deployments
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