diff --git a/.changeset/bumpy-wombats-carry.md b/.changeset/bumpy-wombats-carry.md new file mode 100644 index 00000000..2d054f26 --- /dev/null +++ b/.changeset/bumpy-wombats-carry.md @@ -0,0 +1,5 @@ +--- +"braillify": patch +--- + +Fix space issue diff --git a/Cargo.lock b/Cargo.lock index ca22f03f..483711ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,7 +10,7 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "braillify" -version = "1.0.0" +version = "1.0.1" dependencies = [ "csv", "phf", @@ -272,7 +272,7 @@ dependencies = [ [[package]] name = "python" -version = "1.0.0" +version = "1.0.1" dependencies = [ "braillify", "pyo3", diff --git a/libs/braillify/Cargo.toml b/libs/braillify/Cargo.toml index 6436f9e5..2fb4f290 100644 --- a/libs/braillify/Cargo.toml +++ b/libs/braillify/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "braillify" -version = "1.0.0" +version = "1.0.1" edition = "2024" [dependencies] diff --git a/libs/braillify/src/lib.rs b/libs/braillify/src/lib.rs index d0074495..ce97993d 100644 --- a/libs/braillify/src/lib.rs +++ b/libs/braillify/src/lib.rs @@ -30,7 +30,11 @@ mod word_shortcut; pub fn encode(text: &str) -> Result, String> { let mut result: Vec = Vec::new(); - let words = text.split(' ').collect::>(); + let words = text + .split(' ') + .filter(|word| !word.is_empty()) + .collect::>(); + let word_count = words.len(); let mut is_english = false; // 한국어가 존재할 경우 english_indicator 가 true 가 됩니다. @@ -361,6 +365,7 @@ mod test { use super::*; #[test] pub fn test_encode() { + assert_eq!(encode_to_unicode("상상이상의 ").unwrap(), "⠇⠶⠇⠶⠕⠇⠶⠺"); assert_eq!(encode_to_unicode("안녕\n반가워").unwrap(), "⠣⠒⠉⠻\n⠘⠒⠫⠏"); assert_eq!(encode_to_unicode("BMI(지수)").unwrap(), "⠴⠠⠠⠃⠍⠊⠦⠄⠨⠕⠠⠍⠠⠴"); assert_eq!(encode_to_unicode("지수(BMI)").unwrap(), "⠨⠕⠠⠍⠦⠄⠴⠠⠠⠃⠍⠊⠠⠴"); diff --git a/packages/python/Cargo.toml b/packages/python/Cargo.toml index 44daf23c..a23a3ea1 100644 --- a/packages/python/Cargo.toml +++ b/packages/python/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "python" -version = "1.0.0" +version = "1.0.1" edition = "2024" [lib]