Skip to content
Permalink
Browse files

all cats are beautiful

  • Loading branch information...
iliana committed Sep 11, 2019
1 parent d14ce48 commit 103daed8a4e56c11b42ad55063af6a685cc90a3e
Showing with 21 additions and 28 deletions.
  1. +21 −4 src/bin/classify-twemoji.rs
  2. +0 −24 src/emoji.rs
@@ -33,12 +33,25 @@ enum Classification {
Base(char),
Role(char),
Independent(String),
GeopoliticalFlag,
Couple,
Family,
HoldingHands,
Kiss,
Duplicate,
GeopoliticalFlag,
ACAB,
}

impl Classification {
fn included(&self) -> bool {
match self {
Classification::Duplicate
| Classification::GeopoliticalFlag
| Classification::ACAB
| Classification::Base('\u{1f46e}') => false,
_ => true,
}
}
}

fn main() {
@@ -53,9 +66,7 @@ fn main() {
let path = entry.unwrap().path();
let emoji = emoji_from_file_name(path.file_name().unwrap().to_str().unwrap());
let classification = classify(&emoji);
if !(classification == Classification::Duplicate
|| classification == Classification::GeopoliticalFlag)
{
if classification.included() {
map.entry(classification).or_default().insert(emoji);
}
}
@@ -132,6 +143,12 @@ fn classify(emoji: &str) -> Classification {
}
} else if emoji == "\u{1f46a}" || emoji == "\u{1f48f}" || emoji == "\u{1f491}" {
Classification::Duplicate
} else if emoji == "\u{1f693}"
|| emoji == "\u{1f694}"
|| emoji == "\u{1f6c2}"
|| emoji == "\u{1f6c3}"
{
Classification::ACAB
} else if (0x1f46b..=0x1f46d).contains(&(emoji.chars().next().unwrap() as u32)) {
Classification::HoldingHands
} else if (emoji.chars().count() == 2
@@ -938,26 +938,6 @@ pub(crate) static EMOJI_SETS: &[&[&str]] = &[
"\u{1f469}\u{1f3ff}\u{200d}\u{1f9b2}",
"\u{1f469}\u{1f3ff}\u{200d}\u{1f9b3}",
],
&[
"\u{1f46e}",
"\u{1f46e}\u{200d}\u{2640}\u{fe0f}",
"\u{1f46e}\u{200d}\u{2642}\u{fe0f}",
"\u{1f46e}\u{1f3fb}",
"\u{1f46e}\u{1f3fb}\u{200d}\u{2640}\u{fe0f}",
"\u{1f46e}\u{1f3fb}\u{200d}\u{2642}\u{fe0f}",
"\u{1f46e}\u{1f3fc}",
"\u{1f46e}\u{1f3fc}\u{200d}\u{2640}\u{fe0f}",
"\u{1f46e}\u{1f3fc}\u{200d}\u{2642}\u{fe0f}",
"\u{1f46e}\u{1f3fd}",
"\u{1f46e}\u{1f3fd}\u{200d}\u{2640}\u{fe0f}",
"\u{1f46e}\u{1f3fd}\u{200d}\u{2642}\u{fe0f}",
"\u{1f46e}\u{1f3fe}",
"\u{1f46e}\u{1f3fe}\u{200d}\u{2640}\u{fe0f}",
"\u{1f46e}\u{1f3fe}\u{200d}\u{2642}\u{fe0f}",
"\u{1f46e}\u{1f3ff}",
"\u{1f46e}\u{1f3ff}\u{200d}\u{2640}\u{fe0f}",
"\u{1f46e}\u{1f3ff}\u{200d}\u{2642}\u{fe0f}",
],
&[
"\u{1f46f}",
"\u{1f46f}\u{200d}\u{2640}\u{fe0f}",
@@ -1736,8 +1716,6 @@ pub(crate) static EMOJI_SETS: &[&[&str]] = &[
&["\u{1f690}"],
&["\u{1f691}"],
&["\u{1f692}"],
&["\u{1f693}"],
&["\u{1f694}"],
&["\u{1f695}"],
&["\u{1f696}"],
&["\u{1f697}"],
@@ -1866,8 +1844,6 @@ pub(crate) static EMOJI_SETS: &[&[&str]] = &[
"\u{1f6c0}\u{1f3ff}",
],
&["\u{1f6c1}"],
&["\u{1f6c2}"],
&["\u{1f6c3}"],
&["\u{1f6c4}"],
&["\u{1f6c5}"],
&["\u{1f6cb}\u{fe0f}"],

0 comments on commit 103daed

Please sign in to comment.
You can’t perform that action at this time.