Emojineering Part 1: Machine Learning for Emoji Trends

Instagram Engineering
Instagram Engineering
7 min readMay 1, 2015

--

๐Ÿ†’๐Ÿ†•In October 2011, Apple added the emoji keyboard to iOS as an international keyboard. Since then, digital language has evolved such that nearly half of comments and captions on Instagram contain emoji characters. And earlier this week, Instagram also added support for emoji characters in hashtags, which allows people to tag and search content with their favorite emoji #๐ŸŽ‰.

In Part 1 of this blog post series, we will take a deep dive into emoji usage on Instagram. By applying machine learning and natural language processing techniques, weโ€™ll discover the hidden semantics of emoji.

Emoji on Instagram: Up and to the Right

It is a rare privilege to observe the rise of a new language. Instagram has always supported emoji, but they did not see wide adoption until the introduction of the emoji keyboard on iOS (October 2011) and on most Android platforms (July 2013). The graph below shows the percentage of text (comments and captions) containing emoji characters graphed over time ๐Ÿ“ˆ.

In the month following the introduction of the iOS emoji keyboard, 10% of text on Instagram contained emoji. The trend continued until the release of Instagram for Android in April of 2012, when many new users did not have emoji support. Afterwards, there was a clear upward trend which accelerated after Android received native support for emoji in July 2013.

Usage continued to grow and in March of this year, nearly half of text contained emoji ๐Ÿ˜ฑ. In the future, will all text contain emoji? To help answer that question, we divided emoji usage by country and observed the differences between user cohorts.

The graph below shows that users from Finland are using emoji characters in over 60% of text! In contrast, the lower bound is in Tanzania with only 10% of text containing emoji. If the overall trend continues, we might be looking at a future where the majority of text on Instagramcontains emoji.

Natural Language Processing

Learning an Emoji Representation

Weโ€™re often asked about the meaning of emoji such as ๐Ÿ™‡. Intuitively, substitutable words have similar meanings. For example, we might say that โ€œdogโ€ and โ€œcatโ€ are similar words because they can both be used in sentences like โ€œThe pet store sells _ food.โ€ In the field of natural language processing, this intuition is called the distributional hypothesis ๐ŸŽ“. It can be applied to emoji by treating them as if they are normal words.

More formally, we can place (or embed) emoji and hashtags together with words into a common metric space where there are well-defined distances between elements. The representation of the words are chosen so that similar words have a small distance. In the scatter chart below, we embedded words, emoji, and hashtags into a 100-dimensional space of floating point numbers using 50 million English Instagram comments and captions from 2015.

We learn the floating point numbers using the Gensim library, which re-implements a tool called word2vec. In skip-gram mode, word2vec reads through text and predicts the context around a given word or emoji. If the algorithm predicts the context incorrectly, then it adjusts its internals to make a better guess in the next round. As part of that unsupervised training process, word2vec learns our 100-dimensional representation for words and emoji.

Emoji Translations

Having learned a good representation for emoji, we can begin to ask questions about similarity. Namely, for a given emoji, what English words are semantically similar? For each emoji, we compute the โ€œangleโ€ (equivalently the cosine similarity) between it and other words. Words with a small angle are said to be similar and provide a natural, English-language translation for that emoji.

Using our algorithm, we find that many of our popular emoji have meanings in-line with early internet slang:

  • ๐Ÿ˜‚ (ranked 1st in emoji usage): lolol, lmao, lololol, lolz, lmfao, lmaoo, lolololol, lol, ahahah, ahahha, loll, ahaha, ahah, lmfaoo, ahha, lmaooo, lolll, lollll, ahahaha, ahhaha, lml, lmfaooo
  • ๐Ÿ˜ (ranked 2nd in emoji usage): beautifull, gawgeous, gorgeous, perfff, georgous, gorgous, hottt, goregous, cuteeee, beautifullll, georgeous, baeeeee, hotttt, babeee, sexyyyy, perffff, hawttt
  • โค (ranked 3rd in emoji usage): xoxoxox, xoxoxo, xoxo, xoxoxoxo, xoxoxoxoxo, xoxoxoxox, xxoo, oxox, babycakes, muahhhh, mwahh, babe, boobear, loveyou, bunches, muahhh, muahh, xoxox, muahhhhh
  • ๐Ÿ‘(ranked 9th in emoji usage): #keepitup, #fingerscrossed, aswell, haha, #impressed, #yourock, lol, #greatjob, bud, #goodjob, awesome, good, #muchlove, #proudofyou, job, #goodluck
  • ๐Ÿ˜ญ(ranked 11th in emoji usage): ughh, ughhh, ughhhh, ugh, uggh, ugghh, ughhhhh, ughhhhhh, ugggh, lolol, wahhhh, rn, oml, uhg, agh, xc, omgg, omfg, omf, lololol, whyyy, loll, wahhhhh, tooo, kms

Some of the more distinctive emoji had particularly distinctive meanings:

  • ๐Ÿ™Œ: #waitonit, #justwaitonit, #wonthedoit, #nuffsaid, #yeslawd, #youtherealmvp, #stayblessed, #thatisall, thou, #enoughsaid, leggo, #onlythebeginning
  • ๐Ÿ‘ฏ: #sistasista, #sistersforlife, #sistersister, #bestiesforlife, yearsoffriendship, #sisterfromanothermister, #morelikesisters, #bffl, #bestiesfortheresties, #bestfriendsforever
  • ๐Ÿ’ƒ: #birthdaybehavior, #bdaybehavior, #tu, #ladiesnight, #turnuptime, #dontmissit, #bdaycelebration, #piscesseason, #bethere, turnup, #grownandsexy
  • ๐ŸŽ…: merry, christmas, #merrychristmas, #christmas2014, #christmaseve, #christmastime, xmas, eve, #santa, claus, #happyholidays, #xmas, clause, reindeer, pesach

Naturally, people have strong associations with the flag emoji:

  • ๐Ÿ‡บ๐Ÿ‡ธ : merica, #godblessamerica, โ€˜merica, #murica, #merica, #hooah, #america, #specialforces, #supportourtroops, #goarmy, #redwhiteandblue
  • ๐Ÿ‡ซ๐Ÿ‡ท : paris, france, #eiffeltower, #paris, #france, louvre, italy, #montreal
  • ๐Ÿ‡ฏ๐Ÿ‡ต : #japan, #osaka, #kyoto, #japanese, japan, taipei, osaka, beijing, taiwan, tokyo, #ๆ—ฅๆœฌ

And in answer to our question, we can find that the ๐Ÿ™‡ emoji is associated with: #goodmorningtho,#yadigg,lbvs,#gn,#inmyfeelings,#latenightthoughts,#deletinglater. Personally, I like laughing but very serious (lbvs).

Changing the vocabulary

It seems that the most popular emoji have similar semantics to words like โ€œlol/heheโ€ (๐Ÿ˜‚), โ€œxoxoโ€ (โค๏ธ) and โ€œomgโ€ (๐Ÿ˜ฑ). Are these emoji also replacing the usage of the words?

Precisely, we examine the usage of language in Instagram comments and captions by measuring the percentage of text containing emoji or internet slang. To control for natural changes in Instagram demographics, we examined four cohorts past the launch of Instagram for Android: those joining Instagram in the first week of July 2012, January 2013, July 2013, and January 2014. Each cohort contains millions of Instagram users. We defined internet slang as words matching variants of โ€œxoxoโ€, โ€œomgโ€, โ€œmuahโ€, โ€œbabeโ€, โ€œbaeโ€, โ€œlolโ€, โ€œhaha,โ€ and โ€œheheโ€ with the following regular expression:

(?:\b|#)((?:xo)+|omg+|muah+|babe+|bae+|lol+|(?:ha|he)+h?)(\b|\.|!|\?)

As shown in the chart below, all groups exhibit a similar pattern in the rise of emoji (with an upper bound around 45%) and a decline of internet slang (with a lower bound of around 5%). Correlation coefficients within the respective cohorts are all below -0.93, indicating a strongly negative correlation.

The vocabulary of Instagram is shifting similarly across many different cohorts with a decline in internet slang corresponding to rise in the usage of emoji.

The Hearts of Instagram

Having our vectorized representation opens up a wealth of semantic analysis. One of the purported advantages of word2vec representations are that they allow for algebraic operations in semantic space. For example, it can be particularly hard to distinguish the heart emoji ๐Ÿ’™๐Ÿ’š๐Ÿ’›๐Ÿ’œ๐Ÿ’–๐Ÿ’—๐Ÿ’Œ. We can isolate some of the effects by subtracting off the representation of โค๏ธ and finding similar concepts roughly corresponding to color. For example:

  • ๐Ÿ’™ โ€” โค๏ธ ~= #goblue, #letsgoduke, #bleedblue, #ibleedblue, #worldautismawarenessday, #goduke, #beatduke, #autismspeaks, #autismawarenessday, #gobroncos, duke
  • ๐Ÿ’š โ€” โค๏ธ ~= #gogreen, loyals, #herballife, #happysaintpatricksday, ๐Ÿ, #stpats, ๐Ÿ€, #jointhemovement, green, #hairskinnails, #happystpatricksday
  • ๐Ÿ’› โ€” โค๏ธ ~= ๐ŸŒฑ ,๐ŸŠ ,#springhassprung ,๐Ÿ”† ,#springiscoming ,#springishere, #aprilshowers, #thinkspring, #hellospring, ๐ŸŒป, #wildflower, #happyearthday
  • ๐Ÿ’œ- โค๏ธ~= โœจ, ๐ŸŒ€, ๐Ÿ”ฎ, ๐ŸŒŸ, ๐Ÿ’„, ๐ŸŽ€, faldc, ๐Ÿ’Ž, brassy, topaz, peachy ,purple, #thinkpink,โ˜, sparkle, ๐ŸŒฟ, shimmer, sparkles, kaleidoscope, periwinkle, ๐Ÿ„, greenish
  • ๐Ÿ’– -โค๏ธ ~= gorl, ๐Ÿ’ฎ, cwd, s4s, aynmalik, spvm, ulee, ๐Ÿ’ง, ๐Ÿˆน, yulema, sfs, bvby, ษ‘nd, indirect, priv
  • ๐Ÿ’— -โค๏ธ ~= ulitzer, ๐ŸŽ€, peachy, februaryโ€™s, tulle, mackz, kendallโ€™s, curvy, faldc, #dancewear, strapless, ๐Ÿ‘—, โ—ฝ, floral
  • ๐Ÿ’Œ โ€” โค๏ธ ~= ๐Ÿ“ซ, โ„น, ๐Ÿ“ฌ, ๐Ÿ“ฎ, โœ‰, ๐Ÿ“ฉ, ๐Ÿ’ณ, ๐Ÿ’ป, ๐Ÿ“ฆ, paypal, ๐Ÿ“ง, item, โฌ, ๐Ÿ“ฑ, inquire, orders, payment, ๐Ÿ“„, ๐Ÿ“‹, ๐Ÿ“ฒ, deposit

Naturally, there are some mistakes in this type of algebra. Nonetheless, subtracting off โค๏ธ often leaves us with events highly associated with a specific color like #goblue, #gogreen, peachy and purple.

A Semantic Map

A hundred dimensions are pretty hard for humans to visualize. To visually inspect the relationships between emoji, we can take our 100-dimensional representation for emoji, reduce it two dimensions, and then plot them on a grid. We do this using an algorithm called t-SNE, which attempts to preserve relationships in a visually meaningful way:

Many clusters emerge: food emoji on the left, opposite the work emoji in the top right. Shoes (bottom right) are associated closely to handbags while bathing suits are closer to the water and marine animals (top left). Alcoholic drinks (bottom left) cluster together with bowling. Towards the center, we see a large clustering of facial expressions bordered by sadness, shock, laughter, happiness and coolness. As we travel downwards, we can see happy, love leading all the way the family and wedding emoji.

One has to be careful not to read *too* much into the representation since it is an attempt to produce a 2D space out of a 100D one. But itโ€™s clear that semantics are being approximated in our representation.

Part-1-ing Thoughts

On Instagram, emoji are becoming a valid and near-universal method of expression in all languages. Emoji usage is shifting the peopleโ€™s vocabulary on Instagram and becoming an important means of expression: their use is anti-correlated with internet slang like โ€œlolโ€ and โ€œxoxo.โ€ By observing words and emoji together we were able to discern representations of both. These representations can help us better understand their semantics and find distinctive characteristics of similar symbols.

Stay tuned for Part 2 on how we actually implemented emoji hashtags. #๐Ÿ˜ณ

Thomas Dimson is a Software Engineer on the Instagram Data Team, and also created Instagramโ€™s Hyperlapse app.

Originally published at instagram-engineering.tumblr.com.

--

--