-
-
Notifications
You must be signed in to change notification settings - Fork 29
한국 점자 규정 제47항: 분수 표기 지원 #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
Conversation
|
libs/braillify/src/fraction.rs
Outdated
| '½' => Some((1, 2)), | ||
| '⅓' => Some((1, 3)), | ||
| '⅔' => Some((2, 3)), | ||
| '¼' => Some((1, 4)), | ||
| '¾' => Some((3, 4)), | ||
| '⅕' => Some((1, 5)), | ||
| '⅖' => Some((2, 5)), | ||
| '⅗' => Some((3, 5)), | ||
| '⅘' => Some((4, 5)), | ||
| '⅙' => Some((1, 6)), | ||
| '⅚' => Some((5, 6)), | ||
| '⅛' => Some((1, 8)), | ||
| '⅜' => Some((3, 8)), | ||
| '⅝' => Some((5, 8)), | ||
| '⅞' => Some((7, 8)), |
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.
자음 모음을 분리하듯...뭔가.. 뭔가 방법이 없을까요?
이 방법은 모든 상황을 처리할 수 없습니다
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.
unicode-normalization 크레이트를 추가하여 유니코드 분수 문자를 일반적으로 처리할 수 있도록 구현했습니다. NFKD 정규화를 통해 ⅔, ¾ 등의 분수 문자를 2⁄3, 3⁄4로 분해하여 분자와 분모를 추출합니다.
(https://docs.rs/unicode-normalization/latest/unicode_normalization/)
libs/braillify/src/fraction.rs
Outdated
| let mut result = Vec::new(); | ||
|
|
||
| result.push(60); |
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.
기본적으로 안고 시작하는게 좋겠어요
vec![60]
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.
let mut result = vec![60];로 시작하도록 수정했습니다!
fefaeaf to
f9a253c
Compare
f9a253c to
c058df6
Compare
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
|
테스트 코드만 추가해주심 좋을 것 같습니다! |
c1f6be2 to
9fa3949
Compare
@owjs3901 네 테스트 코드 추가했습니다. 확인 부탁드립니다! |
한국 점자 규정 제47항: 분수 표기 지원
한국 점자 규정 제47항의 분수 표기 규칙을 구현했습니다.
1. 새로운 모듈:
fraction.rs인코딩 함수
encode_fraction(numerator, denominator): 일반 분수 (분모→12→분자)3/4→[60][4][12][60][3]encode_fraction_in_context(numerator, denominator): 문맥 내 분수 (분자→56-12→분모)2/3→[60][2][56][12][60][3]encode_mixed_fraction(whole, numerator, denominator): 대분수3 1/6→[60][3][60][6][12][60][1]파싱 함수
parse_latex_fraction(s): LaTeX 형식 파싱$\frac{3}{4}$→(None, "3", "4")$3\frac{1}{6}$→(Some("3"), "1", "6")parse_unicode_fraction(c): 유니코드 분수 파싱 (NFKD 분해)⅔→("2", "3")is_unicode_fraction(c): 유니코드 분수 문자 판별2.
CharType확장3.
Encoder로직 추가LaTeX 분수 처리
숫자 뒤 분수 처리
정규식
r#"^(\d+)/(\d+)#"으로 패턴 감지 후:12/25,1/4~1/8): 일반 처리2/3):encode_fraction_in_context()사용유니코드 분수 처리
4. 의존성 추가
* 지원하는 분수 형식
$\frac{3}{4}$$3\frac{1}{6}$⅔표면의 2/3는* 테스트 결과