Skip to content

Commit b9756c2

Browse files
authored
Merge pull request #141 from zzaekkii/fix/ellipsis-handling
fix: 줄임표를 잘못 번역하는 문제 해결
2 parents 6f08f5c + e8bb073 commit b9756c2

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

libs/braillify/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ impl Encoder {
102102
skip_count: &mut usize,
103103
result: &mut Vec<u8>,
104104
) -> Result<(), String> {
105+
// 제53항 가운뎃점으로 쓴 줄임표(…… , …)는 ⠠⠠⠠으로, 마침표로 쓴 줄임표(...... , ...)는 ⠲⠲⠲으로 적는다.
106+
let normalized_word = word
107+
.replace("......", "...")
108+
.replace("……", "…");
109+
let word = normalized_word.as_str();
110+
105111
if word.starts_with('$') && word.ends_with('$') {
106112
if let Some((whole, num, den)) = fraction::parse_latex_fraction(word) {
107113
if let Some(w) = whole {

libs/braillify/src/symbol_shortcut.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ static SHORTCUT_MAP: phf::Map<char, &'static [u8]> = phf_map! {
88
'\'' => &[decode_unicode('⠠'), decode_unicode('⠦')],
99
// '\'' => &[decode_unicode('⠴'), decode_unicode('⠄')],
1010
'~' => &[decode_unicode('⠈'), decode_unicode('⠔')],
11-
'…' => &[decode_unicode(''), decode_unicode(''), decode_unicode('')],
11+
'…' => &[decode_unicode(''), decode_unicode(''), decode_unicode('')],
1212
'⋯' => &[decode_unicode('⠠'), decode_unicode('⠠'), decode_unicode('⠠')],
1313
'!' => &[decode_unicode('⠖')],
1414
'.' => &[decode_unicode('⠲')],
@@ -116,9 +116,17 @@ mod test {
116116
assert_eq!(
117117
encode_char_symbol_shortcut('…').unwrap(),
118118
&[
119-
decode_unicode('⠲'),
120-
decode_unicode('⠲'),
121-
decode_unicode('⠲')
119+
decode_unicode('⠠'),
120+
decode_unicode('⠠'),
121+
decode_unicode('⠠')
122+
]
123+
);
124+
assert_eq!(
125+
encode_char_symbol_shortcut('⋯').unwrap(),
126+
&[
127+
decode_unicode('⠠'),
128+
decode_unicode('⠠'),
129+
decode_unicode('⠠')
122130
]
123131
);
124132
assert_eq!(

test_cases/rule_49.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"·","""2",166,⠐⠆
66
":","""1 ",162,⠐⠂
77
"/",_/ ,5612,⠸⠌
8-
"… , ...",",,,, 444",5050500160505050,⠲⠲⠲⠀⠐⠀⠲⠲⠲
8+
"… , ...",",,,, 444",3232320160505050,⠠⠠⠠⠀⠐⠀⠲⠲⠲
99
"",8,38,
1010
"",0,52,
1111
"",",8",3238,⠠⠦

0 commit comments

Comments
 (0)