Skip to content

A better implementation of word golf with XML and flask.

Notifications You must be signed in to change notification settings

rkique/word.golf-2

Repository files navigation

word golf: a sport played with the meanings of words

This is a revised implementation of word golf (word.golf).

What is word golf?

Word golf (word.golf) is a language sport played by moving between static embeddings of words. Given a start word and a grid of its neighbors, your goal is to reach a target word in as few jumps as possible. Every prompt given can be completed in two jumps!

Neighbors are determined by cosine similarity to the target vector, biased towards the start vector. This makes jumping feel more intuitive and ensures that players do not get too far off track.

Screenshot 2023-06-15 at 10 11 44 AM

How it was made

Word golf is built on a modified set of word2vec embeddings, efficiently stored as a gensim KeyedVector.

At the basic level, the frontend uses Jinja templating and the Tachyons CSS framework. However, HTML DOM manipulation is handled by Javascript functions provided in the static folder. The backend follows the Flask Application Factory, and uses Flask Session to persist across client reloads.

The revised version uses XMLHttpRequest(). By sending and receiving JSON instead of entire templates, the app dynamically renders screens without having to reload the page. It also improves the app's load time.

The raw 100 closest neighbors for each word are stored in a text file; at each render, get_curve uses the KeyedVector instance to bias neighbors towards the target vector.

About

A better implementation of word golf with XML and flask.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages