Semantle Solver
Using word embeddings to beat Semantle
Wordle spinoffs are all the rage these days. I learned about a fun one last weekend: Semantle. Here’s the description from the website:
Semantle is a unique word-guessing game that focuses on the meanings of words. Players aim to find a secret word by making guesses that are semantically related. Feedback on each guess helps guide them closer to the target word, offering a challenging and fun experience for those who enjoy exploring language.
The game involves guessing based on semantic similarity, which measures whether two words have similar meaning. Semantic similarity is probably best illustrated by example:
- High semantic similarity (and low spelling similarity): “car” and “automobile”
- Low semantic similarity (and high spelling similarity): “desert” and “dessert”
It’s fun! I played a few rounds, then started wondering if I could build a solver to beat the game more easily. Turns out it was pretty easy.
Gameplay
The game has a very simple interface. You simply enter a word into a text box, then it’ll tell you how “close” your guess was to the secret word.
It’s hard! Here are my results from a recent game, where it took me 11 guesses to get the right answer (“person”):
That’s one of my faster solves—it often takes me more than 20 or 30 guesses if I don’t find a word with high similarity early.
Creating a solver
After a few games I started thinking about creating a solver. I thought surely the game must be built on word embeddings, which are built for the purpose of capturing semantic meaning. So I downloaded some pre-trained word Word2Vec embeddings and implemented the following algorithm:
- The solver chooses a random word from the corpus. The user enters it in Semantle.
- The user enters the similarity score from Semantle and enters it into the solver.
- If
similarity == 100, we’re done. Success! - Otherwise, filter the pool of possible guesses (the Word2Vec corpus) to only the words with a cosine similarity near the entered score.
- The solver chooses the next word to guess: the word with the closest cosine similarity to the last entered score.
- Repeat steps 2-5 until success.
It works! Actually, it works surprisingly well. Here’s the solver playing the same game as above:
% python main.py
--------- remaining solutions: 157,244 ---------
current guess: trackable
Similarity = 21.7
--------- remaining solutions: 129 ---------
Next guess: microbeads
Similarity = 7.28
--------- remaining solutions: 2 ---------
Next guess: person
Similarity = 100
Succeeded after 3 guesses!
As you can see, the solver uses an… interesting strategy. I expected it would play like a human, but better—each subsequent guess would have a higher similarity score, quickly zeroing in on the secret word. But actually, it behaves very differently. With just couple data points, it’s able to drastically reduce the number of possible solutions, even if the previous guesses weren’t very close. It’s basically triangulating to the correct solution, and it’s doing so much more efficiently than I expected.
The result is an extremely good solver. It almost always finds the solution in 3 guesses, sometimes 2, sometimes 41. That said, it does suck the fun out of the game a little bit!
The source code for the solver is here.
-
Roughly 4% success rate in 2 guesses, 88% in 3 guesses, and 8% in 4 guesses in my testing. ↩︎