Word-To-Number banner

Word-To-Number

10 devlogs
23h 51m 18s

An API to convert words to numbers built in the W language: Rust. Fast, efficient, amazing. No disgusting LLMs, just pure, fast pattern matching! If you need LLMs use ai.hackclub.com! This was my first ever API and I’m really proud that I stuck to…

An API to convert words to numbers built in the W language: Rust. Fast, efficient, amazing. No disgusting LLMs, just pure, fast pattern matching! If you need LLMs use ai.hackclub.com! This was my first ever API and I’m really proud that I stuck to no LLM’s and used none to make it too!

This project uses AI

I know I said no LLM’s but I used Claude to generate the OpenAPI spec YAML file, thats it! This is OpenAPI: https://spec.openapis.org/oas/v3.2.0.html

Demo Repository

Loading README...

Akaalroop

Shipped this project!

Hours: 8.53
Cookies: 🍪 266
Multiplier: 25.97 cookies/hr

I have shipped v1.0.0. I read the votes and hopefully :fingers_crossed: , the issues have been ironed out. I now support numbers up to billions, and you can even put multipliers together like “one million billion” (you’ll get a HTTP 400 error if you cross the limit of 2^64). The README has all the stuff about the API so it is a lengthy read, but yeah! The API also now returns extremely specific errors like typo, malformed body, helping you debug if you’re actually using it in an app. I truly hope you love this project as much as I loved making it, and I totally loved losing sleep to make it :pf: . Have fun and any issues please lmk at [email protected] or making a github issue! This was my first ever backend project in my life so don’t expect it to be the best lol.

Akaalroop

Biggest thing is adding support for hyphenated numbers before multipliers. A lot of other small fixes and the docs were updated. It took some time but everything’s all good and we’re ready for 1.0.0!! This devlog isn’t the best because its 23:25 and I really need to meet the deadline and sleep and go to school tomorrow dead .

Changelog

Attachment
Attachment
0
Akaalroop

I added support for huge numbers! Up to a billion! It’s still in PR but I have added it! It was hard, overhauling everything. I had to completely change the way I process the words but I did it, mostly proud of using my own brain yay neocat_happy . The hardest part was the multiple multipliers like “one hundred million” since I used to do 1 * 100 and then it would add 1,000,000 which is obviously wrong. Now it works like a charm! Obviously there a few things to iron out before shipping v1.0.0 but most things are good!

Changelog

Attachment
Attachment
0
Akaalroop

I switched to use serde_json’s json! macro for my responses. I also made the log messages coloured! yay Although I love what I built, its just not as robust as serde_json, so I’ll be making a PR to switch to use that for request parsing blob-sad . The time has come to give in to the serde gods.

Attachment
0
Akaalroop

I overhauled the errors! It now works where the 400 request gives a MUCH more specific error. Like it will tell you about typos, in which word, a non-UTF-8 byte, content length header 0, content length header malformed, body malformed. Yup! Also I changed logging so my logs don’t fill up every time someone sends loads of numbers. Just one clean log per request.

Attachment
Attachment
Attachment
Attachment
Attachment
Attachment
0
Akaalroop

Shipped this project!

Hours: 15.32
Cookies: 🍪 380
Multiplier: 20.68 cookies/hr

I made my first ever API which was really hard, especially since I took on a no-AI challenge. I had to think and my logic was pretty crap at the start, causing all sorts of bugs, but slowly I evolved to now parsing using bytes. I learnt a lot too! The Rust Book Chapter 21 gave me the starting point and I love coding in Rust! Super fun and sleep depriving, but finally API 0.1.0 out! (Not v1.0.0 because I only support up to 999 at the moment)

Akaalroop

I did a LOT. I overhauled the parsing again, this time adding a 411 error code response, since now I actually use the Content-Length header. I had claude generate an openapi spec file. I put my API on scalar. I also made the error JSON specific to each error code. I can’t show 411 & 500 cuz i aint bothered to cause them just for the screenshots. I’ve deployed it, and its 01:05 am. I really gotta sleep man. This took so long and I’m not done yet! But I’m happy with what I’ve got so far, and I really liked making this! Next ship I might make a website for it!

Attachment
Attachment
Attachment
Attachment
0
Akaalroop

I wrote a README. I completely overhauled the logic. I added the README link in the error messages. Basically for the overhaul. I used to read the request line by line, then I switched to byte by byte, as the line by line method kept failing for cURL as cURL didn’t send the final \n. Now I have a LOT of error handling too, like timeouts and if you don’t send a body you get an instant 400 instead of a timeout. Yeah byte-by-byte is better. Its 23:38 (11:38 pm) and I need to sleep. Tomorrow’s school. Good night!

Attachment
Attachment
Attachment
0
Akaalroop

Some improvements! It now supports multiple numbers! Also responds with headers like Cache-Control now. I made some nice code improvements and a super small change is it’s now case-insensitive for the requests. Also fixed a bug for hundreds + single numbers where it just returned the hundred. Like it returned 900 for “nine hundred and four”

Attachment
0
Akaalroop

I started the actual API stuff!! It’s in progress and can take a lot more refining but OMG, in one day, using only the rust book and my own brain, I’ve built, a functioning API (for 127.0.0.1 at least). THIS IS INCREDIBLE. May not look big for you, but this is a huge thing for me, so happy right now!!! NO AI FOR ONCE AS WELL!!!! Super proud of myself yk! Even added some basic error handling too! I’ll write a README and include it in the 400 responses so people know how to format it, but I’m super proud!!

Attachment
Attachment
Attachment
Attachment
Attachment
0
Akaalroop

Now all numbers from 1-999 are supported! Took far too long debugging cuz there was a space at the start of the string past ‘and’ and it confused the code. Anyways fixed! yay

Attachment
Attachment
0
Akaalroop

I’m starting with logic to convert words to numbers first, then API stuff later. We can convert 1-10 and 10,20,30,40,50,60,70,80,90! I’ve selected these numbers as thankfully english just uses those again and again so if now I’ll split numbers like sixty-seven to convert separately, then add together to make 67!

Attachment
0