Home

Thursday, March 24, 2022

Making Moogle

Profile Picture

Charlie Sweeting

@csweeting_

moogle-logo

There are just under a billion cows on the planet. All of them underserved by search engines. This is how Moogle was born. You can find Moogle here, the chrome app here and the videos on YouTube, Tiktok and Twitter.

Building A Language

Cows don’t have an obvious translation framework to work with, so I’ve taken it upon myself to build some common ground. But languages are tough, really tough. They underpin how we communicate and linguists spend years understanding how they evolve. Constructing a new one isn’t trivial, and I don’t have that kind of time, however, I do have the capability to apply brute force to a problem.

I want to build a language that maps to English, doesn’t have long winding words and is solely comprised of Moos. So each English word needs a corresponding Moo and the longest Moo needs to be as short as possible.

So what is a moo? Easy, a word that’s comprised of M’s and O’s and that doesn’t start with an O (that would be an “om”) or have one O in isolation (that would be a Mo not a Moo).

The next question is how we create Moos that are as short as possible. The answer here is more complex, but becomes way simpler when we realise that the challenges directs to a base 2 number system i.e. binary. We can count in binary, replace each 0 and 1 with a corresponding M and O, and disqualify the Moos which don’t fit out criteria. Next map those Moos to the English dictionary, and one fairly simple python script later, we’ve got a super compressed representation of English in valid Moos.

The Moogle Translate Chrome App

A dictionary of English words to all types of Moo’s is useful, but in isolation it’s going to take a while to explain anything and trying to understand the Internet one word at a time would not be easy. Naturally we need a “Moogle Translate”, an interpreter that reads English webpages and creates an equivalent Moo translation.

Chrome extensions provide the perfect infrastructure to do exactly this. They can take the elements rendered in your browser, edit them, and replace them.

Now as an aside, I wrote this extension 2+ years ago in Vanilla Javascript (before I realised you can build chrome extensions using React). It’s messy, buggy and could be rebuilt fairly simply. But my family is worried about the amount of time I’ve committed to making the web searchable for cows, so I haven’t.

The Moogle Translate chrome extension does exactly that. It looks at the HTML on an active page, identifies English words, compares them against the Moo JSON which contains English-Moo translations and then replaces them where there’s a match. The result? Your browsing experience reimagined from English to Moos.

Moogle The Search Engine

What use is a cow-readable version of the internet without a way for humans to understand what ensuing cow contributions look like? Introducing Moogle, a search engine that makes cow content discoverable.

Bundling a 3 MB dictionary into a web page is both lazy and ugly. Long load times and unnecessary bandwidth call for a proper backend. One with low latency for word by word translation and a generous free tier to cover the inevitable size of the cow market. Firebase, awkwardly owned by a competing startup called “Google”, works perfectly.

Each word, detected by a space, entered into the Moogle search bar is sent to a JSON file in an associated instance of a Firebase Realtime Database. If there’s a match with the lowercase version of the word, the translation is sent back and replaced in the Moogle search bar.

Throw in a time-consuming design in Figma, a front-end written in Typescript/React and style it all with Tailwind CSS and you’ve got yourself a robust architecture. Deploy it all with Vercel to take advantage of some static site generation and you’ve now got a search engine that smashes web vitals and serves a new generation of web power-users.

Conclusion

While Moogle is clearly category defining, an original work and obviously uninspired by any existing products I would appreciate a lack of lawsuits. Thanks. Also, the code’s also all open source, take a look.