Skip to content
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

[Feature]: 문자 배열을 입력받아, 한글 규칙에 맞게 합쳐주는 기능을 제공하는 함수 #18

Closed
okinawaa opened this issue Apr 5, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@okinawaa
Copy link
Member

okinawaa commented Apr 5, 2024

Description

assemble(['ㄱ', 'ㅗ', 'ㅎ', 'ㅑ', 'ㅇ']); // 고향
assemble(['ㄱ', 'ㅗ', 'ㅎ']); // �곻
assemble(['프론트엔', 'ㄷ']); // 프론트엔ㄷ

Possible Solution

disassemble의 역함수를 구현하면 될 것 같습니다.

etc.

이 함수는 한글 자음과 모음을 조합하여 완성된 한글 단어를 만들거나, 한글과 다른 문자를 조합할 때 사용될 것 같습니다.

@evan-moon
Copy link
Member

evan-moon commented Apr 10, 2024

까먹기 전에 미리 메모해두자면...

이 함수는 아래와 같이 여러 단계의 관심사를 가진 함수들의 합성으로 정의됩니다.

  1. 인자로 초성, 중성, 종성을 받아 하나의 한글 문자로 합쳐주는 함수
combineHangulCharacter('ㄱ', 'ㅏ', 'ㅇ') // 강
combineHangulCharacter('ㄱ', 'ㅗ') // 고
  1. 두 개의 한글 문자열을 받아 하나의 한글 문자열로 합쳐주는 함수. 이 함수는 첫 번째 인자의 마지막 한글 문자의 성질에 따라 두 번째 인자로 받은 한글 문자를 첫 문자와 어떻게 합칠 것인지, 단순 Join할 것인지를 결정합니다. (한글 비즈니스 로직 * combineHangulCharacter)
binaryAssembleHangul('고양이 좋ㅇ', 'ㅏ') // 고양이 좋아
  1. 인자로 자유로운 한글 문자열을 원소로 가진 배열을 받아 하나의 한글 문자열로 합쳐주는 함수 (disassembleHangul * reduce * binaryAssembleHangul)
assembleHangul(['저는', '고양ㅇ', 'ㅣ', '를', ' ', '좋아', 'ㅎ', 'ㅏ', 'ㅂ', '니다']) // 저는 고양이를 좋아합니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants