Skip to content

xuchef/square-words

Repository files navigation

Square Words

Square Words

Let $w_1$ and $w_2$ be two words, both of length >= 4.

Let $L = \min(\text{len}(w_1), \text{len}(w_2))$.

Then, we say $w_1$ and $w_2$ are square words if there exists an integer $i$ where $2 \leq i \lt L-1$ and $w_1[:i] + w_2[:i] = w_1$ and $w_1[i:] + w_2[i:] = w_2$.

To denote square words, we'll use the tuple $(w_1, w_2, i)$.

For example, ("best", "styles", 2):

Square Words Example

This quick project was inspired by a recent trip to Amsterdam where I stumbled upon this storefront.

Best Styles Zaandam 📍 Best Styles Zaandam, Netherlands

I'm not sure if there's a proper name for this word pattern so I've coined the term square words. If you've seen this somewhere else, please let me know!


First, I grabbed words and their frequencies from Google Books Ngram Viewer.

python proc.py

Then, I found all square words using

python square_words.py

The top 1000 square words by relevance are in square_words.json, which looks like

[
  ["best", "styles", 2],
  ["mike", "kebab", 2],
  ["atomic", "michael", 3],
  ...
]

The full list of square words is in square_words.json.gz.

About

Word pairs that read the same left to right as top to bottom

Resources

Stars

Watchers

Forks