-
Notifications
You must be signed in to change notification settings - Fork 100
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
fix: 일관된 한글 표기법 적용 #138
fix: 일관된 한글 표기법 적용 #138
Changes from 8 commits
bdeca9f
a611eeb
67011d4
2f6b51a
5ff9af8
a6c0c35
63ee040
cfbf101
3cd8012
18dc233
5ee57f9
cad9916
b54423c
33ba976
672e8e1
44db24e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. deprecated 되었다는 표기를 남기고 새로운 문서를 만드는 것이 좋지 않을까요? 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 리뷰해주셔서 감사합니다 ! @minsoo-web
문서 또한 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
네네! 같은 방향으로 이해한 것 같습니다. 예시) 변경 후: 이런 느낌이죠!! 아니면, deprecated features 라는 페이지를 만들어서 기재해두어도 괜찮을 것 같아요! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 넵 알겠습니다 !
정리하자면 위와 같이 진행하면 되는 것일까요?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 제가 바라는 방향성입니다!!
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 넵 저도 @minsoo-web 님 의견 너무 좋습니다~ 문서도 살려두면 좋겠네요! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
import { chosungIncludes } from './chosungIncludes'; | ||
import { choseongIncludes } from './choseongIncludes'; | ||
|
||
describe('chosungIncludes', () => { | ||
describe('choseongIncludes', () => { | ||
describe('초성이 포함되어있다고 판단되는 경우', () => { | ||
it('"ㅍㄹㅌ" 문자열로 "프론트엔드"를 검색하면 true를 반환한다.', () => { | ||
expect(chosungIncludes('프론트엔드', 'ㅍㄹㅌ')).toBe(true); | ||
expect(choseongIncludes('프론트엔드', 'ㅍㄹㅌ')).toBe(true); | ||
}); | ||
|
||
it('"ㅍㄹㅌ" 문자열로 "00프론트엔드"를 검색하면 true를 반환한다.', () => { | ||
expect(chosungIncludes('00프론트엔드', 'ㅍㄹㅌ')).toBe(true); | ||
expect(choseongIncludes('00프론트엔드', 'ㅍㄹㅌ')).toBe(true); | ||
}); | ||
|
||
it('"ㅍㄹㅌㅇㄷㄱㅂㅈ" 문자열로 "프론트엔드 개발자"를 검색하면 true를 반환한다.', () => { | ||
expect(chosungIncludes('프론트엔드 개발자', 'ㅍㄹㅌㅇㄷㄱㅂㅈ')).toBe(true); | ||
expect(choseongIncludes('프론트엔드 개발자', 'ㅍㄹㅌㅇㄷㄱㅂㅈ')).toBe(true); | ||
}); | ||
|
||
it('"ㅍㄹㅌㅇㄷ ㄱㅂㅈ" 문자열로 "프론트엔드 개발자"를 검색하면 true를 반환한다.', () => { | ||
expect(chosungIncludes('프론트엔드 개발자', 'ㅍㄹㅌㅇㄷ ㄱㅂㅈ')).toBe(true); | ||
expect(choseongIncludes('프론트엔드 개발자', 'ㅍㄹㅌㅇㄷ ㄱㅂㅈ')).toBe(true); | ||
}); | ||
}); | ||
|
||
describe('초성이 포함되어있다고 판단되지 않는 경우', () => { | ||
it('"ㅍㅌ" 문자열로 "프론트엔드"를 검색하면 false를 반환한다.', () => { | ||
expect(chosungIncludes('프론트엔드', 'ㅍㅌ')).toBe(false); | ||
expect(choseongIncludes('프론트엔드', 'ㅍㅌ')).toBe(false); | ||
}); | ||
|
||
it('빈 문자열로 "프론트엔드 개발자"를 검색하면 false를 반환한다.', () => { | ||
expect(chosungIncludes('프론트엔드 개발자', ' ')).toBe(false); | ||
expect(choseongIncludes('프론트엔드 개발자', ' ')).toBe(false); | ||
}); | ||
|
||
it('"푸롴트" 문자열로 "프론트엔드"를 검색하면 초성으로만 구성되어 있지 않아 false를 반환한다.', () => { | ||
expect(chosungIncludes('프론트엔드', '푸롴트')).toBe(false); | ||
expect(choseongIncludes('프론트엔드', '푸롴트')).toBe(false); | ||
}); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { disassembleHangulToGroups } from './disassemble'; | ||
import { canBeChoseong, getChoseong } from './utils'; | ||
|
||
export function choseongIncludes(x: string, y: string) { | ||
const trimmedY = y.replace(/\s/g, ''); | ||
|
||
if (!isOnlyChoseong(trimmedY)) { | ||
return false; | ||
} | ||
|
||
const choseongX = getChoseong(x).replace(/\s/g, ''); | ||
const choseongY = trimmedY; | ||
|
||
return choseongX.includes(choseongY); | ||
} | ||
|
||
/* | ||
* @description 문자열이 한글초성으로만 주어진 경우 | ||
*/ | ||
export function isOnlyChoseong(str: string) { | ||
const groups = disassembleHangulToGroups(str); | ||
if (groups.length === 0) { | ||
return false; | ||
} | ||
|
||
return groups.every(disassembled => { | ||
return disassembled.length === 1 && canBeChoseong(disassembled[0]); | ||
}); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,18 @@ | ||
import { disassembleHangulToGroups } from './disassemble'; | ||
import { canBeChosung, getChosung } from './utils'; | ||
import { isOnlyChoseong } from './choseongIncludes'; | ||
import { getChoseong } from './utils'; | ||
|
||
/** | ||
* @deprecated choseongIncludes를 사용해 주세요. | ||
*/ | ||
export function chosungIncludes(x: string, y: string) { | ||
const trimmedY = y.replace(/\s+/g, ''); | ||
|
||
if (!isOnlyChosung(trimmedY)) { | ||
if (!isOnlyChoseong(trimmedY)) { | ||
return false; | ||
} | ||
|
||
const chosungX = getChosung(x).replace(/\s+/g, ''); | ||
const chosungY = trimmedY; | ||
|
||
return chosungX.includes(chosungY); | ||
} | ||
|
||
/* | ||
* @description 문자열이 한글초성으로만 주어진 경우 | ||
*/ | ||
function isOnlyChosung(str: string) { | ||
const groups = disassembleHangulToGroups(str); | ||
if (groups.length === 0) { | ||
return false; | ||
} | ||
const choseongX = getChoseong(x).replace(/\s/g, ''); | ||
const choseongY = trimmedY; | ||
|
||
return groups.every(disassembled => { | ||
return disassembled.length === 1 && canBeChosung(disassembled[0]); | ||
}); | ||
return choseongX.includes(choseongY); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 소문자로 바꾸신 이유가 있으신가요?
이 부분도 sung이 아닌, seong이 되면 좋겠어요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네 알겠습니다 ! 👍
해당 PR에서 hangul을 제외하는 것도 진행해도 괜찮은지 여쭙고 싶습니다 !
만약 PR을 분리해야 한다면, 제가 맡고 싶습니다 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR을 분리하면 좋을 것 같아요!
맡아주신다니 영광입니다, BC가 없도록 두가지 메서드씩 모두 살려두는 방향으로 작업해주시면 좋을 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sung => seong 이 작업 및 컨플리긑 해결 부탁드립니다 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
완료했습니다 !