diff --git a/Project/Tools/Emoji_Distance.py b/Project/Tools/Emoji_Distance.py
new file mode 100644
index 0000000..6aebde8
--- /dev/null
+++ b/Project/Tools/Emoji_Distance.py
@@ -0,0 +1,146 @@
+
+# coding: utf-8
+
+# # Emoji Distance
+# a notebook dealing witch emoji distance measures. Uses an external csv with labeled data to compare arbitriary emojis related to sentiment
+# Autor = Carsten Draschner
+# Version = 0.1
+# ## Used Ressources
+# https://www.clarin.si/repository/xmlui/handle/11356/1048
+# https://github.com/words/emoji-emotion
+
+# In[1]:
+
+
+import pandas as pd
+import math
+import numpy as np
+
+N=3
+# In[53]:
+
+
+#read in csv as panda file
+df = pd.read_csv("/Users/Carsten/GitRepos/NLP-LAB/Project/Tools/Emoji_Sentiment_Data_v1.0.csv", delimiter=";")
+#df.head()
+
+
+# In[54]:
+
+
+#calculates vector distance between 2 3-dim sentiment representations of emojis
+def sentiment_vector_dist(v1,v2):
+ #pos_v1 = v1[0]
+ #neg_v1 = v1[1]
+ #neu_v1 = v1[2]
+
+ #pos_v2 = v2[0]
+ #neg_v2 = v2[1]
+ #neu_v2 = v2[2]
+
+ #tmp_dist = float(np.abs(pos_v1-pos_v2))+float(np.abs(neg_v1-neg_v2))+float(np.abs(neu_v1-neu_v2))
+
+ #calculates vector distance between 2 3-dim sentiment representations of emojis consisting of positive neutral and negative probabilistic occuring
+ tmp_dist = np.linalg.norm(np.array(v1)-np.array(v2))
+ return tmp_dist
+
+
+# In[55]:
+
+
+#calculates vector representation in a 3dim 0 to 1space of dimension: positive,negative,neutral
+def emoji_to_sentiment_vector(e):
+ tmp = df[df["Emoji"]==e]
+ #calculate by espacial labeled occurences devided by sum of overall occurences
+ pos = tmp["Positive"].values[0]/tmp["Occurrences"].values[0]
+ neg = tmp["Negative"].values[0]/tmp["Occurrences"].values[0]
+ neu = tmp["Neutral"].values[0]/tmp["Occurrences"].values[0]
+ #return as np array
+ return np.array([pos,neg,neu])
+
+
+# In[56]:
+
+
+#function to call for evaluating two emojis in its sentimental distance
+def emoji_distance(e1,e2):
+ sent_v1 = emoji_to_sentiment_vector(e1)
+ sent_v2 = emoji_to_sentiment_vector(e2)
+
+ d = sentiment_vector_dist(sent_v1,sent_v2)
+ return d
+
+
+# In[57]:
+
+
+def sentiment_vector_to_emoji(v1):
+ #if(len(v1) == 3):
+ #set initial values to compare with
+ best_emoji = "😐"
+ min_distance = 10000
+
+ #compare only with filtred emoticons
+ df_filtered = df[df["Unicode block"]=="Emoticons"]
+ all_smilies = list(df_filtered["Emoji"])
+ for e in all_smilies:
+ v2 = emoji_to_sentiment_vector(e)
+ d = sentiment_vector_dist(v1,v2)
+ if(d < min_distance):
+ min_distance = d
+ best_emoji = e
+ #print(str(v1),str(v2),str(min_distance),str(type(v1)),str(type(v2)),e)
+
+
+ #print("for sentiment vector: "+str(v1)+" the emoji is : "+str(best_emoji)+" with distance of "+str(min_distance)+"!")
+ return best_emoji
+
+ #else:
+ #print("WRONG SENTIMENT VECTOR")
+
+
+# In[58]:
+
+
+def show_demo():
+ df_filtered = df[df["Unicode block"]=="Emoticons"]
+ all_smilies = list(df_filtered["Emoji"])
+
+ d_m = np.zeros(shape=(len(all_smilies),len(all_smilies)))
+
+ for c1 in range(len(all_smilies)):
+ for c2 in range(len(all_smilies)):
+ e1 = all_smilies[c1]
+ e2 = all_smilies[c2]
+
+ d = emoji_distance(e1,e2)
+ d_m[c1,c2] = d
+
+ for c in range(len(d_m[0])):
+ emoji = all_smilies[c]
+ row = d_m[c]
+ row_sorted = np.argsort(row)
+ #closest 5
+ r = row_sorted[0:10]
+ #print()
+ closest = ""
+ for i in r:
+ closest+=all_smilies[i]
+ print(emoji+": "+closest)
+
+
+# In[60]:
+
+
+#show_demo()
+
+
+# In[61]:
+
+
+#test bipolar matching entiment vector vs. emoji
+#df_filtered = df[df["Unicode block"]=="Emoticons"]
+#all_smilies = list(df_filtered["Emoji"])
+#for e in all_smilies:
+# v2 = emoji_to_sentiment_vector(e)
+# sentiment_vector_to_emoji(v2)
diff --git a/Project/naive_approach/Emoji_Distance.ipynb b/Project/naive_approach/Emoji_Distance.ipynb
index e1bb031..5b2fc06 100644
--- a/Project/naive_approach/Emoji_Distance.ipynb
+++ b/Project/naive_approach/Emoji_Distance.ipynb
@@ -4,6 +4,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
+ "# Emoji Distance\n",
+ "a notebook dealing witch emoji distance measures. Uses an external csv with labeled data to compare arbitriary emojis related to sentiment\n",
+ "Autor = Carsten Draschner\n",
+ "Version = 0.1\n",
+ "## Used Ressources\n",
"https://www.clarin.si/repository/xmlui/handle/11356/1048\n",
"https://github.com/words/emoji-emotion"
]
@@ -24,1216 +29,187 @@
{
"cell_type": "code",
"execution_count": 2,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "
\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " Emoji | \n",
- " Unicode codepoint | \n",
- " Occurrences | \n",
- " Position | \n",
- " Negative | \n",
- " Neutral | \n",
- " Positive | \n",
- " Unicode name | \n",
- " Unicode block | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " 😂 | \n",
- " 0x1f602 | \n",
- " 14622 | \n",
- " 0.805101 | \n",
- " 3614 | \n",
- " 4163 | \n",
- " 6845 | \n",
- " FACE WITH TEARS OF JOY | \n",
- " Emoticons | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " ❤ | \n",
- " 0x2764 | \n",
- " 8050 | \n",
- " 0.746943 | \n",
- " 355 | \n",
- " 1334 | \n",
- " 6361 | \n",
- " HEAVY BLACK HEART | \n",
- " Dingbats | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " ♥ | \n",
- " 0x2665 | \n",
- " 7144 | \n",
- " 0.753806 | \n",
- " 252 | \n",
- " 1942 | \n",
- " 4950 | \n",
- " BLACK HEART SUIT | \n",
- " Miscellaneous Symbols | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " 😍 | \n",
- " 0x1f60d | \n",
- " 6359 | \n",
- " 0.765292 | \n",
- " 329 | \n",
- " 1390 | \n",
- " 4640 | \n",
- " SMILING FACE WITH HEART-SHAPED EYES | \n",
- " Emoticons | \n",
- "
\n",
- " \n",
- " 4 | \n",
- " 😭 | \n",
- " 0x1f62d | \n",
- " 5526 | \n",
- " 0.803352 | \n",
- " 2412 | \n",
- " 1218 | \n",
- " 1896 | \n",
- " LOUDLY CRYING FACE | \n",
- " Emoticons | \n",
- "
\n",
- " \n",
- " 5 | \n",
- " 😘 | \n",
- " 0x1f618 | \n",
- " 3648 | \n",
- " 0.854480 | \n",
- " 193 | \n",
- " 702 | \n",
- " 2753 | \n",
- " FACE THROWING A KISS | \n",
- " Emoticons | \n",
- "
\n",
- " \n",
- " 6 | \n",
- " 😊 | \n",
- " 0x1f60a | \n",
- " 3186 | \n",
- " 0.813302 | \n",
- " 189 | \n",
- " 754 | \n",
- " 2243 | \n",
- " SMILING FACE WITH SMILING EYES | \n",
- " Emoticons | \n",
- "
\n",
- " \n",
- " 7 | \n",
- " 👌 | \n",
- " 0x1f44c | \n",
- " 2925 | \n",
- " 0.805223 | \n",
- " 274 | \n",
- " 728 | \n",
- " 1923 | \n",
- " OK HAND SIGN | \n",
- " Miscellaneous Symbols and Pictographs | \n",
- "
\n",
- " \n",
- " 8 | \n",
- " 💕 | \n",
- " 0x1f495 | \n",
- " 2400 | \n",
- " 0.765726 | \n",
- " 99 | \n",
- " 683 | \n",
- " 1618 | \n",
- " TWO HEARTS | \n",
- " Miscellaneous Symbols and Pictographs | \n",
- "
\n",
- " \n",
- " 9 | \n",
- " 👏 | \n",
- " 0x1f44f | \n",
- " 2336 | \n",
- " 0.787130 | \n",
- " 243 | \n",
- " 634 | \n",
- " 1459 | \n",
- " CLAPPING HANDS SIGN | \n",
- " Miscellaneous Symbols and Pictographs | \n",
- "
\n",
- " \n",
- " 10 | \n",
- " 😁 | \n",
- " 0x1f601 | \n",
- " 2189 | \n",
- " 0.796151 | \n",
- " 278 | \n",
- " 648 | \n",
- " 1263 | \n",
- " GRINNING FACE WITH SMILING EYES | \n",
- " Emoticons | \n",
- "
\n",
- " \n",
- " 11 | \n",
- " ☺ | \n",
- " 0x263a | \n",
- " 2062 | \n",
- " 0.798634 | \n",
- " 128 | \n",
- " 449 | \n",
- " 1485 | \n",
- " WHITE SMILING FACE | \n",
- " Miscellaneous Symbols | \n",
- "
\n",
- " \n",
- " 12 | \n",
- " ♡ | \n",
- " 0x2661 | \n",
- " 1975 | \n",
- " 0.763695 | \n",
- " 102 | \n",
- " 448 | \n",
- " 1425 | \n",
- " WHITE HEART SUIT | \n",
- " Miscellaneous Symbols | \n",
- "
\n",
- " \n",
- " 13 | \n",
- " 👍 | \n",
- " 0x1f44d | \n",
- " 1854 | \n",
- " 0.812126 | \n",
- " 213 | \n",
- " 460 | \n",
- " 1181 | \n",
- " THUMBS UP SIGN | \n",
- " Miscellaneous Symbols and Pictographs | \n",
- "
\n",
- " \n",
- " 14 | \n",
- " 😩 | \n",
- " 0x1f629 | \n",
- " 1808 | \n",
- " 0.826214 | \n",
- " 1069 | \n",
- " 336 | \n",
- " 403 | \n",
- " WEARY FACE | \n",
- " Emoticons | \n",
- "
\n",
- " \n",
- " 15 | \n",
- " 🙏 | \n",
- " 0x1f64f | \n",
- " 1539 | \n",
- " 0.793848 | \n",
- " 124 | \n",
- " 648 | \n",
- " 767 | \n",
- " PERSON WITH FOLDED HANDS | \n",
- " Emoticons | \n",
- "
\n",
- " \n",
- " 16 | \n",
- " ✌ | \n",
- " 0x270c | \n",
- " 1534 | \n",
- " 0.790480 | \n",
- " 173 | \n",
- " 476 | \n",
- " 885 | \n",
- " VICTORY HAND | \n",
- " Dingbats | \n",
- "
\n",
- " \n",
- " 17 | \n",
- " 😏 | \n",
- " 0x1f60f | \n",
- " 1522 | \n",
- " 0.764977 | \n",
- " 170 | \n",
- " 676 | \n",
- " 676 | \n",
- " SMIRKING FACE | \n",
- " Emoticons | \n",
- "
\n",
- " \n",
- " 18 | \n",
- " 😉 | \n",
- " 0x1f609 | \n",
- " 1521 | \n",
- " 0.844833 | \n",
- " 151 | \n",
- " 513 | \n",
- " 857 | \n",
- " WINKING FACE | \n",
- " Emoticons | \n",
- "
\n",
- " \n",
- " 19 | \n",
- " 🙌 | \n",
- " 0x1f64c | \n",
- " 1506 | \n",
- " 0.790600 | \n",
- " 152 | \n",
- " 358 | \n",
- " 996 | \n",
- " PERSON RAISING BOTH HANDS IN CELEBRATION | \n",
- " Emoticons | \n",
- "
\n",
- " \n",
- " 20 | \n",
- " 🙈 | \n",
- " 0x1f648 | \n",
- " 1456 | \n",
- " 0.738881 | \n",
- " 238 | \n",
- " 350 | \n",
- " 868 | \n",
- " SEE-NO-EVIL MONKEY | \n",
- " Emoticons | \n",
- "
\n",
- " \n",
- " 21 | \n",
- " 💪 | \n",
- " 0x1f4aa | \n",
- " 1409 | \n",
- " 0.806704 | \n",
- " 101 | \n",
- " 424 | \n",
- " 884 | \n",
- " FLEXED BICEPS | \n",
- " Miscellaneous Symbols and Pictographs | \n",
- "
\n",
- " \n",
- " 22 | \n",
- " 😄 | \n",
- " 0x1f604 | \n",
- " 1398 | \n",
- " 0.794973 | \n",
- " 191 | \n",
- " 426 | \n",
- " 781 | \n",
- " SMILING FACE WITH OPEN MOUTH AND SMILING EYES | \n",
- " Emoticons | \n",
- "
\n",
- " \n",
- " 23 | \n",
- " 😒 | \n",
- " 0x1f612 | \n",
- " 1385 | \n",
- " 0.857621 | \n",
- " 819 | \n",
- " 266 | \n",
- " 300 | \n",
- " UNAMUSED FACE | \n",
- " Emoticons | \n",
- "
\n",
- " \n",
- " 24 | \n",
- " 💃 | \n",
- " 0x1f483 | \n",
- " 1344 | \n",
- " 0.852765 | \n",
- " 59 | \n",
- " 237 | \n",
- " 1048 | \n",
- " DANCER | \n",
- " Miscellaneous Symbols and Pictographs | \n",
- "
\n",
- " \n",
- " 25 | \n",
- " 💖 | \n",
- " 0x1f496 | \n",
- " 1263 | \n",
- " 0.762239 | \n",
- " 54 | \n",
- " 254 | \n",
- " 955 | \n",
- " SPARKLING HEART | \n",
- " Miscellaneous Symbols and Pictographs | \n",
- "
\n",
- " \n",
- " 26 | \n",
- " 😃 | \n",
- " 0x1f603 | \n",
- " 1206 | \n",
- " 0.734782 | \n",
- " 86 | \n",
- " 361 | \n",
- " 759 | \n",
- " SMILING FACE WITH OPEN MOUTH | \n",
- " Emoticons | \n",
- "
\n",
- " \n",
- " 27 | \n",
- " 😔 | \n",
- " 0x1f614 | \n",
- " 1205 | \n",
- " 0.866146 | \n",
- " 559 | \n",
- " 263 | \n",
- " 383 | \n",
- " PENSIVE FACE | \n",
- " Emoticons | \n",
- "
\n",
- " \n",
- " 28 | \n",
- " 😱 | \n",
- " 0x1f631 | \n",
- " 1130 | \n",
- " 0.773313 | \n",
- " 298 | \n",
- " 319 | \n",
- " 513 | \n",
- " FACE SCREAMING IN FEAR | \n",
- " Emoticons | \n",
- "
\n",
- " \n",
- " 29 | \n",
- " 🎉 | \n",
- " 0x1f389 | \n",
- " 1125 | \n",
- " 0.743636 | \n",
- " 43 | \n",
- " 207 | \n",
- " 875 | \n",
- " PARTY POPPER | \n",
- " Miscellaneous Symbols and Pictographs | \n",
- "
\n",
- " \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- "
\n",
- " \n",
- " 939 | \n",
- " 🕥 | \n",
- " 0x1f565 | \n",
- " 1 | \n",
- " 0.811966 | \n",
- " 1 | \n",
- " 0 | \n",
- " 0 | \n",
- " CLOCK FACE TEN-THIRTY | \n",
- " Miscellaneous Symbols and Pictographs | \n",
- "
\n",
- " \n",
- " 940 | \n",
- " ♙ | \n",
- " 0x2659 | \n",
- " 1 | \n",
- " 0.342857 | \n",
- " 0 | \n",
- " 1 | \n",
- " 0 | \n",
- " WHITE CHESS PAWN | \n",
- " Miscellaneous Symbols | \n",
- "
\n",
- " \n",
- " 941 | \n",
- " ▿ | \n",
- " 0x25bf | \n",
- " 1 | \n",
- " 0.432836 | \n",
- " 0 | \n",
- " 1 | \n",
- " 0 | \n",
- " WHITE DOWN-POINTING SMALL TRIANGLE | \n",
- " Geometric Shapes | \n",
- "
\n",
- " \n",
- " 942 | \n",
- " ⚃ | \n",
- " 0x2683 | \n",
- " 1 | \n",
- " 0.918919 | \n",
- " 0 | \n",
- " 1 | \n",
- " 0 | \n",
- " DIE FACE-4 | \n",
- " Miscellaneous Symbols | \n",
- "
\n",
- " \n",
- " 943 | \n",
- " ✽ | \n",
- " 0x273d | \n",
- " 1 | \n",
- " 0.992701 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " HEAVY TEARDROP-SPOKED ASTERISK | \n",
- " Dingbats | \n",
- "
\n",
- " \n",
- " 944 | \n",
- " 📼 | \n",
- " 0x1f4fc | \n",
- " 1 | \n",
- " 1.000000 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " VIDEOCASSETTE | \n",
- " Miscellaneous Symbols and Pictographs | \n",
- "
\n",
- " \n",
- " 945 | \n",
- " 🕐 | \n",
- " 0x1f550 | \n",
- " 1 | \n",
- " 1.000000 | \n",
- " 1 | \n",
- " 0 | \n",
- " 0 | \n",
- " CLOCK FACE ONE OCLOCK | \n",
- " Miscellaneous Symbols and Pictographs | \n",
- "
\n",
- " \n",
- " 946 | \n",
- " 🀄 | \n",
- " 0x1f004 | \n",
- " 1 | \n",
- " 1.000000 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " MAHJONG TILE RED DRAGON | \n",
- " Mahjong Tiles | \n",
- "
\n",
- " \n",
- " 947 | \n",
- " ✾ | \n",
- " 0x273e | \n",
- " 1 | \n",
- " 0.023256 | \n",
- " 0 | \n",
- " 1 | \n",
- " 0 | \n",
- " SIX PETALLED BLACK AND WHITE FLORETTE | \n",
- " Dingbats | \n",
- "
\n",
- " \n",
- " 948 | \n",
- " ✬ | \n",
- " 0x272c | \n",
- " 1 | \n",
- " 0.955224 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " BLACK CENTRE WHITE STAR | \n",
- " Dingbats | \n",
- "
\n",
- " \n",
- " 949 | \n",
- " 🆑 | \n",
- " 0x1f191 | \n",
- " 1 | \n",
- " 0.983607 | \n",
- " 0 | \n",
- " 1 | \n",
- " 0 | \n",
- " SQUARED CL | \n",
- " Enclosed Alphanumeric Supplement | \n",
- "
\n",
- " \n",
- " 950 | \n",
- " ✫ | \n",
- " 0x272b | \n",
- " 1 | \n",
- " 0.923729 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " OPEN CENTRE BLACK STAR | \n",
- " Dingbats | \n",
- "
\n",
- " \n",
- " 951 | \n",
- " 🕔 | \n",
- " 0x1f554 | \n",
- " 1 | \n",
- " 0.742424 | \n",
- " 1 | \n",
- " 0 | \n",
- " 0 | \n",
- " CLOCK FACE FIVE OCLOCK | \n",
- " Miscellaneous Symbols and Pictographs | \n",
- "
\n",
- " \n",
- " 952 | \n",
- " ❣ | \n",
- " 0x2763 | \n",
- " 1 | \n",
- " 0.471429 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " HEAVY HEART EXCLAMATION MARK ORNAMENT | \n",
- " Dingbats | \n",
- "
\n",
- " \n",
- " 953 | \n",
- " ➱ | \n",
- " 0x27b1 | \n",
- " 1 | \n",
- " 0.704348 | \n",
- " 0 | \n",
- " 1 | \n",
- " 0 | \n",
- " NOTCHED UPPER RIGHT-SHADOWED WHITE RIGHTWARDS ... | \n",
- " Dingbats | \n",
- "
\n",
- " \n",
- " 954 | \n",
- " 🆕 | \n",
- " 0x1f195 | \n",
- " 1 | \n",
- " 0.669118 | \n",
- " 0 | \n",
- " 1 | \n",
- " 0 | \n",
- " SQUARED NEW | \n",
- " Enclosed Alphanumeric Supplement | \n",
- "
\n",
- " \n",
- " 955 | \n",
- " ➢ | \n",
- " 0x27a2 | \n",
- " 1 | \n",
- " 0.242647 | \n",
- " 0 | \n",
- " 1 | \n",
- " 0 | \n",
- " THREE-D TOP-LIGHTED RIGHTWARDS ARROWHEAD | \n",
- " Dingbats | \n",
- "
\n",
- " \n",
- " 956 | \n",
- " ↕ | \n",
- " 0x2195 | \n",
- " 1 | \n",
- " 0.735632 | \n",
- " 0 | \n",
- " 1 | \n",
- " 0 | \n",
- " UP DOWN ARROW | \n",
- " Arrows | \n",
- "
\n",
- " \n",
- " 957 | \n",
- " 📫 | \n",
- " 0x1f4eb | \n",
- " 1 | \n",
- " 0.384615 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " CLOSED MAILBOX WITH RAISED FLAG | \n",
- " Miscellaneous Symbols and Pictographs | \n",
- "
\n",
- " \n",
- " 958 | \n",
- " 🉐 | \n",
- " 0x1f250 | \n",
- " 1 | \n",
- " 0.031250 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " CIRCLED IDEOGRAPH ADVANTAGE | \n",
- " Enclosed Ideographic Supplement | \n",
- "
\n",
- " \n",
- " 959 | \n",
- " ♊ | \n",
- " 0x264a | \n",
- " 1 | \n",
- " 0.327586 | \n",
- " 0 | \n",
- " 1 | \n",
- " 0 | \n",
- " GEMINI | \n",
- " Miscellaneous Symbols | \n",
- "
\n",
- " \n",
- " 960 | \n",
- " 🈂 | \n",
- " 0x1f202 | \n",
- " 1 | \n",
- " 0.466667 | \n",
- " 1 | \n",
- " 0 | \n",
- " 0 | \n",
- " SQUARED KATAKANA SA | \n",
- " Enclosed Ideographic Supplement | \n",
- "
\n",
- " \n",
- " 961 | \n",
- " 🎰 | \n",
- " 0x1f3b0 | \n",
- " 1 | \n",
- " 0.421687 | \n",
- " 1 | \n",
- " 0 | \n",
- " 0 | \n",
- " SLOT MACHINE | \n",
- " Miscellaneous Symbols and Pictographs | \n",
- "
\n",
- " \n",
- " 962 | \n",
- " ҂ | \n",
- " 0x482 | \n",
- " 1 | \n",
- " 0.519231 | \n",
- " 1 | \n",
- " 0 | \n",
- " 0 | \n",
- " CYRILLIC THOUSANDS SIGN | \n",
- " Cyrillic | \n",
- "
\n",
- " \n",
- " 963 | \n",
- " ╤ | \n",
- " 0x2564 | \n",
- " 1 | \n",
- " 0.634615 | \n",
- " 1 | \n",
- " 0 | \n",
- " 0 | \n",
- " BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE | \n",
- " Box Drawing | \n",
- "
\n",
- " \n",
- " 964 | \n",
- " ➛ | \n",
- " 0x279b | \n",
- " 1 | \n",
- " 0.011628 | \n",
- " 0 | \n",
- " 1 | \n",
- " 0 | \n",
- " DRAFTING POINT RIGHTWARDS ARROW | \n",
- " Dingbats | \n",
- "
\n",
- " \n",
- " 965 | \n",
- " ♝ | \n",
- " 0x265d | \n",
- " 1 | \n",
- " 0.280000 | \n",
- " 0 | \n",
- " 1 | \n",
- " 0 | \n",
- " BLACK CHESS BISHOP | \n",
- " Miscellaneous Symbols | \n",
- "
\n",
- " \n",
- " 966 | \n",
- " ❋ | \n",
- " 0x274b | \n",
- " 1 | \n",
- " 0.888889 | \n",
- " 0 | \n",
- " 1 | \n",
- " 0 | \n",
- " HEAVY EIGHT TEARDROP-SPOKED PROPELLER ASTERISK | \n",
- " Dingbats | \n",
- "
\n",
- " \n",
- " 967 | \n",
- " ✆ | \n",
- " 0x2706 | \n",
- " 1 | \n",
- " 0.557252 | \n",
- " 0 | \n",
- " 1 | \n",
- " 0 | \n",
- " TELEPHONE LOCATION SIGN | \n",
- " Dingbats | \n",
- "
\n",
- " \n",
- " 968 | \n",
- " 📔 | \n",
- " 0x1f4d4 | \n",
- " 1 | \n",
- " 0.814815 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " NOTEBOOK WITH DECORATIVE COVER | \n",
- " Miscellaneous Symbols and Pictographs | \n",
- "
\n",
- " \n",
- "
\n",
- "
969 rows × 9 columns
\n",
- "
"
- ],
- "text/plain": [
- " Emoji Unicode codepoint Occurrences Position Negative Neutral \\\n",
- "0 😂 0x1f602 14622 0.805101 3614 4163 \n",
- "1 ❤ 0x2764 8050 0.746943 355 1334 \n",
- "2 ♥ 0x2665 7144 0.753806 252 1942 \n",
- "3 😍 0x1f60d 6359 0.765292 329 1390 \n",
- "4 😭 0x1f62d 5526 0.803352 2412 1218 \n",
- "5 😘 0x1f618 3648 0.854480 193 702 \n",
- "6 😊 0x1f60a 3186 0.813302 189 754 \n",
- "7 👌 0x1f44c 2925 0.805223 274 728 \n",
- "8 💕 0x1f495 2400 0.765726 99 683 \n",
- "9 👏 0x1f44f 2336 0.787130 243 634 \n",
- "10 😁 0x1f601 2189 0.796151 278 648 \n",
- "11 ☺ 0x263a 2062 0.798634 128 449 \n",
- "12 ♡ 0x2661 1975 0.763695 102 448 \n",
- "13 👍 0x1f44d 1854 0.812126 213 460 \n",
- "14 😩 0x1f629 1808 0.826214 1069 336 \n",
- "15 🙏 0x1f64f 1539 0.793848 124 648 \n",
- "16 ✌ 0x270c 1534 0.790480 173 476 \n",
- "17 😏 0x1f60f 1522 0.764977 170 676 \n",
- "18 😉 0x1f609 1521 0.844833 151 513 \n",
- "19 🙌 0x1f64c 1506 0.790600 152 358 \n",
- "20 🙈 0x1f648 1456 0.738881 238 350 \n",
- "21 💪 0x1f4aa 1409 0.806704 101 424 \n",
- "22 😄 0x1f604 1398 0.794973 191 426 \n",
- "23 😒 0x1f612 1385 0.857621 819 266 \n",
- "24 💃 0x1f483 1344 0.852765 59 237 \n",
- "25 💖 0x1f496 1263 0.762239 54 254 \n",
- "26 😃 0x1f603 1206 0.734782 86 361 \n",
- "27 😔 0x1f614 1205 0.866146 559 263 \n",
- "28 😱 0x1f631 1130 0.773313 298 319 \n",
- "29 🎉 0x1f389 1125 0.743636 43 207 \n",
- ".. ... ... ... ... ... ... \n",
- "939 🕥 0x1f565 1 0.811966 1 0 \n",
- "940 ♙ 0x2659 1 0.342857 0 1 \n",
- "941 ▿ 0x25bf 1 0.432836 0 1 \n",
- "942 ⚃ 0x2683 1 0.918919 0 1 \n",
- "943 ✽ 0x273d 1 0.992701 0 0 \n",
- "944 📼 0x1f4fc 1 1.000000 0 0 \n",
- "945 🕐 0x1f550 1 1.000000 1 0 \n",
- "946 🀄 0x1f004 1 1.000000 0 0 \n",
- "947 ✾ 0x273e 1 0.023256 0 1 \n",
- "948 ✬ 0x272c 1 0.955224 0 0 \n",
- "949 🆑 0x1f191 1 0.983607 0 1 \n",
- "950 ✫ 0x272b 1 0.923729 0 0 \n",
- "951 🕔 0x1f554 1 0.742424 1 0 \n",
- "952 ❣ 0x2763 1 0.471429 0 0 \n",
- "953 ➱ 0x27b1 1 0.704348 0 1 \n",
- "954 🆕 0x1f195 1 0.669118 0 1 \n",
- "955 ➢ 0x27a2 1 0.242647 0 1 \n",
- "956 ↕ 0x2195 1 0.735632 0 1 \n",
- "957 📫 0x1f4eb 1 0.384615 0 0 \n",
- "958 🉐 0x1f250 1 0.031250 0 0 \n",
- "959 ♊ 0x264a 1 0.327586 0 1 \n",
- "960 🈂 0x1f202 1 0.466667 1 0 \n",
- "961 🎰 0x1f3b0 1 0.421687 1 0 \n",
- "962 ҂ 0x482 1 0.519231 1 0 \n",
- "963 ╤ 0x2564 1 0.634615 1 0 \n",
- "964 ➛ 0x279b 1 0.011628 0 1 \n",
- "965 ♝ 0x265d 1 0.280000 0 1 \n",
- "966 ❋ 0x274b 1 0.888889 0 1 \n",
- "967 ✆ 0x2706 1 0.557252 0 1 \n",
- "968 📔 0x1f4d4 1 0.814815 0 0 \n",
- "\n",
- " Positive Unicode name \\\n",
- "0 6845 FACE WITH TEARS OF JOY \n",
- "1 6361 HEAVY BLACK HEART \n",
- "2 4950 BLACK HEART SUIT \n",
- "3 4640 SMILING FACE WITH HEART-SHAPED EYES \n",
- "4 1896 LOUDLY CRYING FACE \n",
- "5 2753 FACE THROWING A KISS \n",
- "6 2243 SMILING FACE WITH SMILING EYES \n",
- "7 1923 OK HAND SIGN \n",
- "8 1618 TWO HEARTS \n",
- "9 1459 CLAPPING HANDS SIGN \n",
- "10 1263 GRINNING FACE WITH SMILING EYES \n",
- "11 1485 WHITE SMILING FACE \n",
- "12 1425 WHITE HEART SUIT \n",
- "13 1181 THUMBS UP SIGN \n",
- "14 403 WEARY FACE \n",
- "15 767 PERSON WITH FOLDED HANDS \n",
- "16 885 VICTORY HAND \n",
- "17 676 SMIRKING FACE \n",
- "18 857 WINKING FACE \n",
- "19 996 PERSON RAISING BOTH HANDS IN CELEBRATION \n",
- "20 868 SEE-NO-EVIL MONKEY \n",
- "21 884 FLEXED BICEPS \n",
- "22 781 SMILING FACE WITH OPEN MOUTH AND SMILING EYES \n",
- "23 300 UNAMUSED FACE \n",
- "24 1048 DANCER \n",
- "25 955 SPARKLING HEART \n",
- "26 759 SMILING FACE WITH OPEN MOUTH \n",
- "27 383 PENSIVE FACE \n",
- "28 513 FACE SCREAMING IN FEAR \n",
- "29 875 PARTY POPPER \n",
- ".. ... ... \n",
- "939 0 CLOCK FACE TEN-THIRTY \n",
- "940 0 WHITE CHESS PAWN \n",
- "941 0 WHITE DOWN-POINTING SMALL TRIANGLE \n",
- "942 0 DIE FACE-4 \n",
- "943 1 HEAVY TEARDROP-SPOKED ASTERISK \n",
- "944 1 VIDEOCASSETTE \n",
- "945 0 CLOCK FACE ONE OCLOCK \n",
- "946 1 MAHJONG TILE RED DRAGON \n",
- "947 0 SIX PETALLED BLACK AND WHITE FLORETTE \n",
- "948 1 BLACK CENTRE WHITE STAR \n",
- "949 0 SQUARED CL \n",
- "950 1 OPEN CENTRE BLACK STAR \n",
- "951 0 CLOCK FACE FIVE OCLOCK \n",
- "952 1 HEAVY HEART EXCLAMATION MARK ORNAMENT \n",
- "953 0 NOTCHED UPPER RIGHT-SHADOWED WHITE RIGHTWARDS ... \n",
- "954 0 SQUARED NEW \n",
- "955 0 THREE-D TOP-LIGHTED RIGHTWARDS ARROWHEAD \n",
- "956 0 UP DOWN ARROW \n",
- "957 1 CLOSED MAILBOX WITH RAISED FLAG \n",
- "958 1 CIRCLED IDEOGRAPH ADVANTAGE \n",
- "959 0 GEMINI \n",
- "960 0 SQUARED KATAKANA SA \n",
- "961 0 SLOT MACHINE \n",
- "962 0 CYRILLIC THOUSANDS SIGN \n",
- "963 0 BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE \n",
- "964 0 DRAFTING POINT RIGHTWARDS ARROW \n",
- "965 0 BLACK CHESS BISHOP \n",
- "966 0 HEAVY EIGHT TEARDROP-SPOKED PROPELLER ASTERISK \n",
- "967 0 TELEPHONE LOCATION SIGN \n",
- "968 1 NOTEBOOK WITH DECORATIVE COVER \n",
- "\n",
- " Unicode block \n",
- "0 Emoticons \n",
- "1 Dingbats \n",
- "2 Miscellaneous Symbols \n",
- "3 Emoticons \n",
- "4 Emoticons \n",
- "5 Emoticons \n",
- "6 Emoticons \n",
- "7 Miscellaneous Symbols and Pictographs \n",
- "8 Miscellaneous Symbols and Pictographs \n",
- "9 Miscellaneous Symbols and Pictographs \n",
- "10 Emoticons \n",
- "11 Miscellaneous Symbols \n",
- "12 Miscellaneous Symbols \n",
- "13 Miscellaneous Symbols and Pictographs \n",
- "14 Emoticons \n",
- "15 Emoticons \n",
- "16 Dingbats \n",
- "17 Emoticons \n",
- "18 Emoticons \n",
- "19 Emoticons \n",
- "20 Emoticons \n",
- "21 Miscellaneous Symbols and Pictographs \n",
- "22 Emoticons \n",
- "23 Emoticons \n",
- "24 Miscellaneous Symbols and Pictographs \n",
- "25 Miscellaneous Symbols and Pictographs \n",
- "26 Emoticons \n",
- "27 Emoticons \n",
- "28 Emoticons \n",
- "29 Miscellaneous Symbols and Pictographs \n",
- ".. ... \n",
- "939 Miscellaneous Symbols and Pictographs \n",
- "940 Miscellaneous Symbols \n",
- "941 Geometric Shapes \n",
- "942 Miscellaneous Symbols \n",
- "943 Dingbats \n",
- "944 Miscellaneous Symbols and Pictographs \n",
- "945 Miscellaneous Symbols and Pictographs \n",
- "946 Mahjong Tiles \n",
- "947 Dingbats \n",
- "948 Dingbats \n",
- "949 Enclosed Alphanumeric Supplement \n",
- "950 Dingbats \n",
- "951 Miscellaneous Symbols and Pictographs \n",
- "952 Dingbats \n",
- "953 Dingbats \n",
- "954 Enclosed Alphanumeric Supplement \n",
- "955 Dingbats \n",
- "956 Arrows \n",
- "957 Miscellaneous Symbols and Pictographs \n",
- "958 Enclosed Ideographic Supplement \n",
- "959 Miscellaneous Symbols \n",
- "960 Enclosed Ideographic Supplement \n",
- "961 Miscellaneous Symbols and Pictographs \n",
- "962 Cyrillic \n",
- "963 Box Drawing \n",
- "964 Dingbats \n",
- "965 Miscellaneous Symbols \n",
- "966 Dingbats \n",
- "967 Dingbats \n",
- "968 Miscellaneous Symbols and Pictographs \n",
- "\n",
- "[969 rows x 9 columns]"
- ]
- },
- "execution_count": 2,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "df = pd.read_csv(\"/Users/Carsten/GitRepos/NLP-LAB/Project/Tools/Emoji_Sentiment_Data_v1.0.csv\", delimiter=\";\")\n",
- "df#.head()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 3,
- "metadata": {},
- "outputs": [],
- "source": [
- "df_filtered = df[df[\"Unicode block\"]==\"Emoticons\"]"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 4,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "array(['😂', '😍', '😭', '😘', '😊', '😁', '😩', '🙏', '😏', '😉', '🙌', '🙈', '😄',\n",
- " '😒', '😃', '😔', '😱', '😜', '😳', '😡', '😎', '😢', '😋', '🙊', '😴', '😌',\n",
- " '😞', '😆', '😝', '😪', '😫', '😅', '😀', '😚', '😻', '😥', '😕', '😤', '😈',\n",
- " '😰', '😑', '😹', '😠', '😓', '😣', '😐', '😨', '😖', '😷', '🙋', '😛', '😬',\n",
- " '😙', '🙆', '🙅', '🙉', '😇', '😿', '😲', '😶', '😵', '😸', '😧', '😮', '😽',\n",
- " '🙀', '🙇', '😟', '😯', '😦', '🙍', '😺', '😾', '😼', '🙎', '😗'], dtype=object)"
- ]
- },
- "execution_count": 4,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "df_filtered['Emoji'].values"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {},
- "outputs": [],
- "source": [
- "def sentiment_vector_dist(v1,v2):\n",
- " pos_v1 = v1[0]\n",
- " neg_v1 = v1[1]\n",
- " neu_v1 = v1[2]\n",
- " \n",
- " pos_v2 = v2[0]\n",
- " neg_v2 = v2[1]\n",
- " neu_v2 = v2[2]\n",
- " \n",
- " #tmp_dist = float(np.abs(pos_v1-pos_v2))+float(np.abs(neg_v1-neg_v2))+float(np.abs(neu_v1-neu_v2))\n",
- "\n",
- "\n",
- " \n",
- " tmp_dist = np.linalg.norm(np.array(v1)-np.array(v2))\n",
- " \n",
- " return tmp_dist\n",
- " \n",
- "#sentiment_vector_dist([0.2,.9,.01],[0.3,0.3,0.4])"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 6,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "array([[ 0.46813021],\n",
- " [ 0.24716181],\n",
- " [ 0.28470797]])"
- ]
- },
- "execution_count": 6,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "def emoji_to_sentiment_vector(e):\n",
- " tmp = df[df[\"Emoji\"]==e]\n",
- " \n",
- " #display(\"tmp\", tmp[\"Positive\"])\n",
- " \n",
- " pos = tmp[\"Positive\"].values/tmp[\"Occurrences\"].values\n",
- " neg = tmp[\"Negative\"].values/tmp[\"Occurrences\"].values\n",
- " neu = tmp[\"Neutral\"].values/tmp[\"Occurrences\"].values\n",
- " \n",
- " return np.array([pos,neg,neu])\n",
- "\n",
- "emoji_to_sentiment_vector(\"😂\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 7,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
+ "#read in csv as panda file\n",
+ "df = pd.read_csv(\"/Users/Carsten/GitRepos/NLP-LAB/Project/Tools/Emoji_Sentiment_Data_v1.0.csv\", delimiter=\";\")\n",
+ "#df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "#calculates vector distance between 2 3-dim sentiment representations of emojis\n",
+ "def sentiment_vector_dist(v1,v2):\n",
+ " #pos_v1 = v1[0]\n",
+ " #neg_v1 = v1[1]\n",
+ " #neu_v1 = v1[2]\n",
+ " \n",
+ " #pos_v2 = v2[0]\n",
+ " #neg_v2 = v2[1]\n",
+ " #neu_v2 = v2[2]\n",
+ " \n",
+ " #tmp_dist = float(np.abs(pos_v1-pos_v2))+float(np.abs(neg_v1-neg_v2))+float(np.abs(neu_v1-neu_v2))\n",
+ " \n",
+ " #calculates vector distance between 2 3-dim sentiment representations of emojis consisting of positive neutral and negative probabilistic occuring\n",
+ " tmp_dist = np.linalg.norm(np.array(v1)-np.array(v2)) \n",
+ " return tmp_dist"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "#calculates vector representation in a 3dim 0 to 1space of dimension: positive,negative,neutral\n",
+ "def emoji_to_sentiment_vector(e):\n",
+ " tmp = df[df[\"Emoji\"]==e] \n",
+ " #calculate by espacial labeled occurences devided by sum of overall occurences\n",
+ " pos = tmp[\"Positive\"].values/tmp[\"Occurrences\"].values\n",
+ " neg = tmp[\"Negative\"].values/tmp[\"Occurrences\"].values\n",
+ " neu = tmp[\"Neutral\"].values/tmp[\"Occurrences\"].values\n",
+ " #return as np array\n",
+ " return np.array([pos,neg,neu])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "#function to call for evaluating two emojis in its sentimental distance\n",
"def emoji_distance(e1,e2):\n",
" sent_v1 = emoji_to_sentiment_vector(e1)\n",
" sent_v2 = emoji_to_sentiment_vector(e2)\n",
- " #display(sent_v1, sent_v2)\n",
+ " \n",
" d = sentiment_vector_dist(sent_v1,sent_v2)\n",
" return d"
]
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 42,
"metadata": {},
"outputs": [],
"source": [
- "all_smilies = list(df_filtered[\"Emoji\"])\n",
- "#all_smilies = list(df[\"Emoji\"])\n",
- "\n",
- "\n",
- "d_m = np.zeros(shape=(len(all_smilies),len(all_smilies)))\n",
- "#c1,c2 = 0\n",
- "for c1 in range(len(all_smilies)):\n",
- " for c2 in range(len(all_smilies)):\n",
- " e1 = all_smilies[c1]\n",
- " e2 = all_smilies[c2]\n",
+ "def sentiment_vector_to_emoji(v1):\n",
+ " #if(len(v1) == 3):\n",
+ " #set initial values to compare with\n",
+ " best_emoji = \"😐\"\n",
+ " min_distance = 10000\n",
" \n",
- " d = emoji_distance(e1,e2)\n",
- " d_m[c1,c2] = d\n",
- " \n",
- " #print(e1,e2,d)\n",
+ " #compare only with filtred emoticons\n",
+ " df_filtered = df[df[\"Unicode block\"]==\"Emoticons\"]\n",
+ " all_smilies = list(df_filtered[\"Emoji\"])\n",
+ " for e in all_smilies:\n",
+ " v2 = emoji_to_sentiment_vector(e)\n",
+ " d = sentiment_vector_dist(v1,v2)\n",
+ " if(d < min_distance):\n",
+ " min_distance = d\n",
+ " best_emoji = e\n",
+ " print(str(v1),str(v2),str(min_distance),str(type(v1)),str(type(v2)),e)\n",
"\n",
- " \n"
+ "\n",
+ " print(\"for sentiment vector: \"+str(v1)+\" the emoji is : \"+str(best_emoji)+\" with distance of \"+str(min_distance)+\"!\")\n",
+ " return best_emoji\n",
+ " \n",
+ " #else:\n",
+ " #print(\"WRONG SENTIMENT VECTOR\")"
]
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 43,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "def show_demo():\n",
+ " df_filtered = df[df[\"Unicode block\"]==\"Emoticons\"]\n",
+ " all_smilies = list(df_filtered[\"Emoji\"])\n",
+ "\n",
+ " d_m = np.zeros(shape=(len(all_smilies),len(all_smilies)))\n",
+ "\n",
+ " for c1 in range(len(all_smilies)):\n",
+ " for c2 in range(len(all_smilies)):\n",
+ " e1 = all_smilies[c1]\n",
+ " e2 = all_smilies[c2]\n",
+ "\n",
+ " d = emoji_distance(e1,e2)\n",
+ " d_m[c1,c2] = d\n",
+ " \n",
+ " for c in range(len(d_m[0])):\n",
+ " emoji = all_smilies[c]\n",
+ " row = d_m[c]\n",
+ " row_sorted = np.argsort(row)\n",
+ " #closest 5\n",
+ " r = row_sorted[0:10]\n",
+ " #print()\n",
+ " closest = \"\"\n",
+ " for i in r:\n",
+ " closest+=all_smilies[i]\n",
+ " print(emoji+\": \"+closest)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 46,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "😂: 😂😱😬🙇😈😹😅😥🙉😵\n",
- "😍: 😍😊😘😚😻😛😋😇🙌😀\n",
- "😭: 😭😪😓😴😔😷😖😫😢😨\n",
- "😘: 😘😚😍😙😊😗😛😻😽😋\n",
- "😊: 😊😻😛😍😇😋😀🙌😘😚\n",
- "😁: 😁😄😝😎🙊😜😆🙆😉🙋\n",
- "😩: 😩😒😕🙍😿😾😠😦😐😑\n",
- "🙏: 🙏😏😸😉🙀😮😜😝😄🙉\n",
- "😏: 😏🙏😮🙀😸😈🙉😉😜😝\n",
- "😉: 😉😜😸😝🙆😄😁😎😆🙊\n",
- "🙌: 🙌😀😛😻😇🙋😌😊😋😃\n",
- "🙈: 🙈😼😌🙊🙋😆😁😄😺😎\n",
- "😄: 😄😝😁😆😜🙊😉😎😸🙉\n",
- "😒: 😒😩😕😿🙍😾😠😦😐😑\n",
- "😃: 😃🙆😎😀😇😋🙋🙌😁🙊\n",
- "😔: 😔😷😭😖😪😓😴😫😤😨\n",
- "😱: 😱😬😂🙇😹😅😥😵😈😯\n",
- "😜: 😜😉😝😁😄🙆😎😸😆🙊\n",
- "😳: 😳😲😧😵😯🙇😹😶😢😥\n",
- "😡: 😡😣😞🙎😫😖😰😠😔😷\n",
- "😎: 😎🙆😁🙊😜😃😄😝🙋😉\n",
- "😢: 😢😟😪😓😴😭😵😥😧😰\n",
- "😋: 😋😇😻😀😊😃😛🙌😍🙆\n",
- "🙊: 🙊🙋😁😆😎🙈😌😄😼😝\n",
- "😴: 😴😭😪😓😔😧😨😢😷😲\n",
- "😌: 😌🙋🙈🙊🙌😼😀😎😆😁\n",
- "😞: 😞😫😖🙎😰😓😔😡😪😭\n",
- "😆: 😆😄😁🙊😝😼🙈😜😎🙉\n",
- "😝: 😝😄😜😁😆😉😸😎🙊🙆\n",
- "😪: 😪😓😭😴😔😢😷😖😫😞\n",
- "😫: 😫😖😞😔😷😭😓😪😣😡\n",
- "😅: 😅😹😥😬🙇😱😂😟😵😢\n",
- "😀: 😀😇🙌😻😛😋😃🙋😊😌\n",
- "😚: 😚😘😍😙😗😊😛😻😽😋\n",
- "😻: 😻😊😛😇😀😋🙌😍😘😃\n",
- "😥: 😥😹😟😅😵🙇😬😱😢😂\n",
- "😕: 😕😒😩😿🙍😾😠😦😐😑\n",
- "😤: 😤🙅😷😨😔😶😑😖😭😴\n",
- "😈: 😈😮🙉🙀😂😱😬😯🙇😄\n",
- "😰: 😰🙎😞😫😓😢😪😭😖😟\n",
- "😑: 😑😦😐🙅😤😿😶😒😨😕\n",
- "😹: 😹🙇😥😬😅😵😱😂😟😢\n",
- "😠: 😠🙍😾😩😒😕😿😣😖😫\n",
- "😓: 😓😪😭😴😔😢😷😖😫😞\n",
- "😣: 😣😡😫😞😠😖🙍😾🙎😷\n",
- "😐: 😐😦😑😿😕😒😩🙅😤🙍\n",
- "😨: 😨😶🙅😤😧😲😴😔😷😭\n",
- "😖: 😖😫😔😷😞😭😓😪😣😴\n",
- "😷: 😷😔😖😤😭😫😪😓😨😴\n",
- "🙋: 🙋😌🙊🙈😎🙌😀😁😆😼\n",
- "😛: 😛😻😊🙌😀😇😍😋😘😽\n",
- "😬: 😬😱😂🙇😹😅😥😵😈😟\n",
- "😙: 😙😚😘😗😍😊😛😻😽😋\n",
- "🙆: 🙆😎😜😃😉😁😝😄🙊😸\n",
- "🙅: 🙅😤😶😨😑😷😔😲😧😴\n",
- "🙉: 🙉🙀😈😄😝😆😸😮😁😜\n",
- "😇: 😇😀😋😻🙌😊😛😃🙋😍\n",
- "😿: 😿😒😕😩🙍😦😠😐😾😑\n",
- "😲: 😲😧😶😨😴😳😭😪😓🙅\n",
- "😶: 😶😨🙅😲😧😤😴😔😷😭\n",
- "😵: 😵🙇😹😥😟😱😬😅😢😳\n",
- "😸: 😸😉😜😝😄🙀😁🙉🙆😎\n",
- "😧: 😧😲😨😴😶😭😪😳😓😢\n",
- "😮: 😮😈🙀🙉😏😸😯😂🙏😱\n",
- "😽: 😽😛😘😍😚🙌😊😻😗😺\n",
- "🙀: 🙀🙉😮😈😸😝😄😜😉😆\n",
- "🙇: 🙇😹😱😬😵😥😂😅😟😯\n",
- "😟: 😟😥😢😵😹😅🙇😬😱😓\n",
- "😯: 😯😳🙇😱😈😵😮😂😬😹\n",
- "😦: 😦😐😑😿😕😒😩🙅😤🙍\n",
- "🙍: 🙍😾😩😠😒😕😿😣😖😡\n",
- "😺: 😺🙈😌😼🙋😽🙊🙌😆😛\n",
- "😾: 😾🙍😩😠😒😕😿😣😡😖\n",
- "😼: 😼🙈😆🙊😌😁🙋😄😝🙉\n",
- "🙎: 🙎😰😞😡😫😖😣😓😪😭\n",
- "😗: 😗😙😚😘😽😍😊😛😻🙌\n"
+ "[[ 0.39118825]\n",
+ " [ 0.38451268]\n",
+ " [ 0.22429907]] [[ 0.46813021]\n",
+ " [ 0.24716181]\n",
+ " [ 0.28470797]] 0.168625514858 😂\n",
+ "[[ 0.39118825]\n",
+ " [ 0.38451268]\n",
+ " [ 0.22429907]] [[ 0.34310532]\n",
+ " [ 0.43648208]\n",
+ " [ 0.2204126 ]] 0.0709076267317 😭\n",
+ "[[ 0.39118825]\n",
+ " [ 0.38451268]\n",
+ " [ 0.22429907]] [[ 0.39118825]\n",
+ " [ 0.38451268]\n",
+ " [ 0.22429907]] 0.0 😢\n",
+ "for sentiment vector: [[ 0.39118825]\n",
+ " [ 0.38451268]\n",
+ " [ 0.22429907]] the emoji is : 😢 with distance of 0.0!\n"
]
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'😢'"
+ ]
+ },
+ "execution_count": 46,
+ "metadata": {},
+ "output_type": "execute_result"
}
],
"source": [
- "for c in range(len(d_m[0])):\n",
- " emoji = all_smilies[c]\n",
- " row = d_m[c]\n",
- " row_sorted = np.argsort(row)\n",
- " #closest 5\n",
- " r = row_sorted[0:10]\n",
- " #print()\n",
- " closest = \"\"\n",
- " for i in r:\n",
- " closest+=all_smilies[i]\n",
- " print(emoji+\": \"+closest)\n",
- " "
+ "#show_demo()\n",
+ "v11 = emoji_to_sentiment_vector(\"😢\")\n",
+ "sentiment_vector_to_emoji(v11)"
]
},
{