quick experiment: python library for real-time offline translation (english to spanish)

wow, pip install argotranslate, and the offline translation just works

and it works fast

Seems plenty fast to me to actually use in real time!

The library is: argos-translate

The code is straight from their github.

https://github.com/argosopentech/argos-translate

code

import argostranslate.package
import argostranslate.translate

from_code = "en"
to_code = "es"

# Download and install Argos Translate package
argostranslate.package.update_package_index()
available_packages = argostranslate.package.get_available_packages()
package_to_install = next(
    filter(
        lambda x: x.from_code == from_code and x.to_code == to_code, available_packages
    )
)
argostranslate.package.install_from_path(package_to_install.download())

# Translate
translatedText = argostranslate.translate.translate("Hello World", from_code, to_code)
print(translatedText)

 def trans(phrase):
   ...:     return argostranslate.translate.translate(phrase, from_code, to_code)

trans('I think it will be more than fast enough for real-time use')
>>> 'Creo que será más que lo suficientemente rápido para uso en tiempo real'

other tools to check out

(haven’t bothered yet)

https://github.com/OpenNMT/CTranslate2

according to https://skeptric.com/python-offline-translation “Argos Translate is a more complete solution, is easier to get set up, and is substantially faster. However Marian Machine Translation gives better translations, supports more languages, and better supports batch translations.”

Note: The tool will fail if the punctuation and capitalization is not correct however.

back story

The idea is to create a translation t-shirt. So take the following project one step further:

The code / instructions are here: https://github.com/ZackFreedman/DeepgramSubtitleHoodie /

(It looks like he used a $75 touch screen (“stretched bar display”), I guess he had it lying around ?? I’m not sure that’s where I want to be swiping around on myself lol) (but maybe that is the cheapest?)

Basically just pipe output of the real time speech to text tool to the translation tool,

Then wear an apron with the screen built-in. So I can speak and have the apron-tablet auto-translate.

Actually, it could have a fold-out mirror. So if there were also vision problems, I could look down at the mirror and just speak the translated text out loud XD;

i would feel like such a nerd

actually though this would be a neat tool for traveling to another country,

waiting for google translate lag (both in terms of phone processor and 4g availability) is a pain

if I am just using stuff I already have, maybe the next step is installing linux on a switch — that’s the closest to a portable screen I have at the moment… (I was playing FFXII really intensely but have since lost interest, I think due to not being sure what direction to take the game)

ALTERNATIVELY. A youtube commenter suggested — I could make a persistence of vision hat, and that would be pretty darn cheap haha.

And… need a glare / matte screen apparently. See 13:07.

rambles

I’m not sure how I feel about this, it might reduce my motivation to learn languages. I guess once I make real moneys I would like to pay for Spanish lessons or something similar. @__@ (And Chinese lessons for that matter). I’ve also discovered though that maybe I’m not the greatest at learning languages? I have no idea.

Life feels weirdly short and long. I was too busy recovering from crisis in my mid-20s to have too much of a quarter life crisis I guess. But now that I am emerging out of one crisis, I feel a bit adrift in terms of identity and what I’m trying to do with my life.