Inspiration

One fascinating thing you can do with word2vec is running arithmetics on words. For example, what would you get if you add company to student? With a pretrained word2vec model and gensim library, you can add them up with code snippet like so:

fasttext_model = load_fasttext_model()
student_vec = fasttext_model.get_vector("student")
company_vec = fasttext_model.get_vector("company")
sims = similar_by_word(fasttext_model, student_vec + company_vec, top_n=20)
for sim in sims:
  print(sim)

for which the output you get is:

('student', 0.8150711059570312)
('company', 0.7167820334434509)
('students', 0.6097120642662048)
('university', 0.5893406867980957)
('teacher', 0.5812615156173706)
('employee', 0.5798979997634888)
('Student', 0.5722908973693848)
('sudent', 0.5689769387245178)

Well guess what, you get teacher and employee, as one of the most similar words to the sum of student and company!

We found this so interesting that we wanted to build a game out of this, and this project is our attempt to do so.

What it does

So how does the game work? On starting the game, you are given with start_word and an end_word. Your goal in this game then, is to add a word to start_word or subtract a word from start_word to reach end_word. You'll be given only two attempts for add or sub, so be mindful of your choices! After your 2nd attempt, the game ends with your final score - the cosine distance from the resulting vector to end_word.

In a way, this way of "mixing" the semantics of words is analogous to a chemical experiment where you mix different substances made of different elements to yield yet another substance. This is what we named our project after - word-chemist - which, we think resonates well with the theme of the hackathon!

How we built it

Because both of us are working remotely, we split our work into backend(Eu-Bin) and frontend(Liudvikas). We joined our work by designing a RESTful API for bridging frontend and backend.

Challenges I ran into

Working remotely was the biggest challenge! But it wasn't a huge hindrance, thanks to limitless hours we can spend on Zoom :)

Built With

Share this project:

Updates