palabras

At the moment I’m trying to learn Spanish. I’d say I’m probably at intermediate level, trying to remember conjugations in various tenses and when to switch to the subjunctive.

For practicing Spanish I’ve been playing with LLMs. Having a chat where they correct you and as you for example sentences is really powerful.

I’ve also been doing lessons with a real person. A lovely lady who is not particularly tech savvy, but is a great teacher.

The lesson setup tends to be a Google Meet call, where we both have a shared Google Doc open. She’ll write everything which is said in this document so I can see what the words are in case I missed them in speaking.

Key features

To improve this experience, the following features would be really useful:

The stack

I’ve been using Elixir professionally for a while now and love the experience of building backends in the language. Liveview, I have used in a previous project my team focused on, but have since moved focus to React and that whole ecosystem.

Liveview is close to a 1.0 release at this point however, so I feel like I need to keep my skills sharp with that way of authoring applications. This particular use case seems pretty well suited to it as well, as the actual dynamic parts are relatively simple, and the heavy lifting is done by the backend and data model.

Incorporating Bloom

In a separate devlog I talk about my work with Bloom, a project I’ve been contributing to. This library is a set of components for Liveview, and I’ve been working on the JS interop for it.

I needed a good testbed project to kick the tyres with some on the ideas in Bloom, and this seemed perfect.

Translation of individual words

I spanish lessons with my teacher, I set myself the homework ( deberes ) of reading about the new set of laws around animal rights and welfare which have passed last year in Spain. A good challenge for my vocabulary, and a good way to learn a lot more by studying a written text.

https://www.boe.es/buscar/doc.php?id=BOE-A-2023-7936

To do this I set myself up with the above document in one Arc tab, with a second split to the right with Lingva (a different frontend to Google Translate) open to translate individual words.

I found this to be a really effective way to learn, but I kept repeatedly translating the same words over and over. I needed a history list of what I had translated previously.

All of the above could easily be catered for in this project. I just need to find an API or datasource which I can hit with a specific word, and then store the translation against the user in the database. Simples.

Finding the Datasource

Some googling uncovered WikDict - a creative commons dictionary project.

They release a list of SQLite databases which can be downloaded and used in your own applications.

At least to begin with I think I’ll start there and see how far I can get with that.

Trying the google translate API

My original thought was to use Google’s Translate APIs for translating text of more than just a single word for word translation. There is an Elixir library which wraps the Google Translate API, which could be helpful, although the docs leave a lot to be desired.

GCP has a free tier which I can use to test the API, which gave me $300 worth of credit. Nice, but the setup was horendous. I had to create a project, enable billing, enable the API, create a service account, download the credentials, and then use those credentials in my Elixir app.

But that wasn’t enough. I still needed to OAuth authenticate the bloody request.

No. Just no. I just want a somple backend API I can call (and eventually cache the result from).

Experience with DeepL

I cast my eyes around for alternatives and found DeepL. They have a free tier which is more than enough for my needs. I signed up, got an API key, and was able to make a request to their API really quickly.

The only catch is that they don’t have an Elixir library. But the API is simple enough that I can use it directly.