Porting Autocorrect by Filip Sondej to Luau

Return Home
January 27th, 2025
to January 27th, 2025

Introduction

You can skip to Starting Out part if you want to skip my personal thoughts and talk.

I have stumbled upon autocorrect, as I was trying to find a good resource that could achieve what I wanted to do in my game, which is automatic word correction.

I was happy to see that exactly what I was looking for existed in the open source space. But it came with a good surprise that I didn't know I would be happy to stumble across, even more than finding the autocorrect library.

As I started reading through the README.md file of the library, I saw a name attached to a website link, Peter Norvig. A name which didn't sound familiar but I went to visit his site nonetheless and what a site it was. It was so simple yet it hooked me in. It started a fire inside me that wanted to make his own website and write about whatever it is that I am working at the moment and well here we are.

Starting Out

To get a good start, I began porting the library to Luau by changing all the python extensions to luau extensions (.py -> .luau). After that was done, I started rewrting the python code in Luau with the autocorrect/init.luau file.

As I started rewriting the file in luau, I realized that it was automatically downloading the count of word frequencies for each languages upon initialization if the word_count files do not exist for the give language. Unfortunately, this workflow did not satisfy my use case so I began to search for where it was downloading the word_count files from.