Git Product home page Git Product logo

emoji2vec-jiali-ms's Introduction

emoji2vec

A demo project to play word embedding and emoji with twitter data. Let's see how we can make a smarter emoji predictor.

Believe it or not, we have 1800+ emoji from standard Unicode. How to find one from them? Traditionally, we search key words of emoji description. We will use word embedding to find the best match with a context. The results reflects real users habit from social media. Now you are guided with most knowledgeable emoji master :)

Check the site http://nlpfun.com/emoji for a preview of what we can do next with the model!

Data

The zip file in the data folder is a 1M sentences with emoji from Twitter about 2017-Jan. It is randomly selected set from a much bigger corpus. Unzip the corpus.txt directly into the data folder for training.

Training

Run train.py file. Don't forget to set correct parameters like vector size, windows size, etc. It will dump a model and a raw text file for the embedding.

Install the gensim first with python 3.5

pip install -r requirements.txt

Results

Let's run the model.py and see the console output. If you ever played word2vec before, you know the answer for the famous play 'King' - 'man' + 'woman' = ? . Let check the results with our simple twitter data.

query + ['king', 'woman'] - ['man']
[('queen', 0.73), ('crown', 0.7), ('goddess', 0.7), ('princess', 0.7), ('actress', 0.69)]

query + ['china', 'tokyo'] - ['beijing']
[('japan', 0.73), ('theatre', 0.69), ('europe', 0.68), ('nyc', 0.67), ('nuttiness', 0.67)]

query + ['dog', 'cats'] - ['dogs']
[('cat', 0.92), ('kitten', 0.75), ('puppy', 0.73), ('coworker', 0.71), ('mom', 0.69)]

Finally, let's see how well we can find emoji by key words!

query + ['cat'] - []
[('๐Ÿฑ', 0.66), ('๐Ÿถ', 0.5), ('๐Ÿˆ', 0.47), ('๐Ÿฐ', 0.42), ('๐Ÿ•', 0.4), ('๐Ÿญ', 0.39)]

query + ['happy', 'new', 'year'] - []
[('๐ŸŽ‰', 0.56), ('๐ŸŽ„', 0.38), ('๐Ÿ†', 0.38), ('๐Ÿพ', 0.37), ('๐ŸŽ', 0.36)]

query + ['king', 'woman'] - ['man']
[('๐Ÿ‘‘', 0.63), ('๐Ÿ‘ธ', 0.59), ('๐Ÿฆ', 0.56)]

query + ['๐Ÿ’—'] - []
[('๐Ÿ’“', 0.94), ('๐Ÿ’œ', 0.92), ('๐Ÿ’–', 0.92), ('๐Ÿ’˜', 0.91), ('๐Ÿ’ž', 0.91), ('๐Ÿ’•', 0.91), ('๐Ÿ’›', 0.81), ('๐Ÿ’™', 0.81), ('๐Ÿ’Ÿ', 0.79), ('๐Ÿ’', 0.72)]

To better understanding what's going on inside, here are some recommendations:
https://blog.acolyer.org/2016/04/21/the-amazing-power-of-word-vectors/ http://web.stanford.edu/class/cs224n/assignment1/index.html

Visualization

Visualization in two dimension

emoji2vec-jiali-ms's People

Contributors

jiali-ms avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.