Skip to content

Conversation

@bbungjin
Copy link
Contributor

@bbungjin bbungjin commented Oct 5, 2025

Overview

현재 es-hangul은 getChoseong을 이용하여 초성 추출 API를 제공하고 있습니다.
모든 한글 구성요소의 일관성을 유지하려면 중성(모음) 및 종성(종성) 추출 API도 제공하는 것이 어떨까 합니다.
resolved #365

getJungseong('사과'); // 'ㅏㅘ'
getJungseong('하늘'); // 'ㅏㅡ'
getJungseong('띄어 쓰기'); // ' ㅢㅓ ㅡㅣ'
getJongseong('별');   // 'ㄹ'
getJongseong('하늘'); // 'ㄹ'
getJongseong('띄어 쓰기'); // ' '
getJongseong('파이팅'); // 'ㅇ'

논의거리

getChoseong, getJungseong, getJongseong 모두 존재하는 자모만 추출, 공백은 그대로 유지라는 동일한 규칙을 적용합니다.
그래서 '띄어 쓰기', '파이팅' 이라는 단어에 대해서 현재 다음과 같이 종성을 추출합니다.

  • "띄어 쓰기" → 종성이 없고 공백만 존재하므로 " "
  • "파이팅" → 종성이 실제로 있는 글자만 남아 "ㅇ"
getJongseong('띄어 쓰기'); // ' '
getJongseong('파이팅'); // 'ㅇ' 

하지만 종성 추출에서 "없는 종성"을 어떻게 다룰지는 여러 선택지가 있을 수 있습니다.

  • "띄어 쓰기" → "" (아예 생략) 혹은 " " (공백만 유지)
  • "파이팅" → " ㅇ" (모든 글자 위치를 유지, 종성이 없는 자리는 빈칸 처리)
getJongseong('띄어 쓰기'); // '' or ' '
getJongseong('파이팅'); // '  ㅇ' 

현재는 간결성과 검색/비교 활용성을 우선하여
“존재하는 자모만 추출 + 공백만 유지” 규칙을 채택했지만,
향후 유스케이스에 따라 조정 가능성이 있습니다.

PR Checklist

  • I read and included theses actions below
  1. I have read the Contributing Guide
  2. I have written documents and tests, if needed.

@changeset-bot
Copy link

changeset-bot bot commented Oct 5, 2025

⚠️ No Changeset found

Latest commit: eab2f53

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Oct 5, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
es-hangul Ready Ready Preview Comment Oct 23, 2025 4:14pm

@okinawaa
Copy link
Member

좋은 기능 제안 및 구현 감사합니다.
다른 API 문서 와 같이 위 만들어주신 두개에 대한 문서를 만들어주실 수 있으실까요?

@bbungjin
Copy link
Contributor Author

좋은 기능 제안 및 구현 감사합니다. 다른 API 문서 와 같이 위 만들어주신 두개에 대한 문서를 만들어주실 수 있으실까요?
@okinawaa
넵 추가했습니다.

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.

[Feature]: 중성, 종성에 관한 추출 함수를 제안합니다.

2 participants