Skip to content

Commit

Permalink
Only add emojis to dict
Browse files Browse the repository at this point in the history
  • Loading branch information
Riey committed Jul 30, 2024
1 parent cce2b6c commit ab8e05b
Show file tree
Hide file tree
Showing 4 changed files with 321 additions and 3 deletions.
314 changes: 313 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/engine/core/tests/emoji.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn thinking() {
test_input(&[
(EMOJI, "🏻(light skin tone)🏼(medium-light skin tone)🏽(medium skin tone)🏾(medium-dark skin tone)🏿(dark skin tone)", ""),
(Key::normal(T), "t🏻(light skin tone)🏼(medium-light skin tone)🏽(medium skin tone)🏾(medium-dark skin tone)🏿(dark skin tone)", ""),
(Key::normal(H), "th😁(beaming face with smiling eyes)😂(face with tears of joy)🤣(rolling on the floor laughing)😃(grinning face with big eyes)😄(grinning face with smiling eyes)", ""),
(Key::normal(H), "th😃(grinning face with big eyes)😄(grinning face with smiling eyes)😁(beaming face with smiling eyes)😅(grinning face with sweat)🤣(rolling on the floor laughing)", ""),
(Key::normal(I), "thi🤔(thinking face)🕧(twelve-thirty)🕜(one-thirty)🕝(two-thirty)🕞(three-thirty)", ""),
(Key::normal(N), "thin🤔(thinking face)", ""),
(Key::normal(K), "think🤔(thinking face)", ""),
Expand Down
3 changes: 2 additions & 1 deletion src/engine/dict/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ license = "GPL-3.0-or-later"
[build-dependencies]
serde = {version = "1.0.118", features = ["derive"]}
serde_json = "1.0"
itertools = "0.10.0"
itertools = "0.13.0"
quick-xml = { version = "0.27.1", features = ["encoding"] }
unic = "0.9.0"
5 changes: 5 additions & 0 deletions src/engine/dict/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use std::{
mem,
path::PathBuf,
};
use unic::emoji::char::is_emoji;

#[derive(Default, Debug, Clone, Copy)]
struct HanjaEntry {
Expand Down Expand Up @@ -203,6 +204,10 @@ fn main() {
)
.unwrap();
for entry in load_unicode_annotations().unwrap() {
if !entry.cp.chars().any(|c| is_emoji(c)) {
continue;
}

writeln!(
out,
"UnicodeAnnotation {{ codepoint: \"{}\", tts: \"{}\" }},",
Expand Down

0 comments on commit ab8e05b

Please sign in to comment.