Tag Archives: translate

leo: Laid-back online learning

As online translation tools go, leo is doing a very good job.

2015-03-05-6m47421-leo

leo is part of the WWW::Dict::Leo::Org perl package, and as far as I can tell, will only access the Leo dictionary site. For what I have seen of it, Leo works primarily into and out of German, with English and French as the main target (or source, of course) languages.

That does mean if you’re not interested in those languages, or if you’re working in a language that isn’t covered, leo might not be practical. On the other hand, it’s a good example of how a text-based online dictionary tool can work.

I’ve seen a few translation tools for the console, and the ones that worked weren’t terribly electrifying. leo seems to have a good grasp of how the output should appear.

Color is good, the table arrangement is easy to read, and aside from the rather wide dimensions, this is a good style for easy cutting-and-pasting. leo will take a term as a target or through STDIN, so you can pipe text into leo without disrupting the process.

Error handling seems a little primitive, since unknown words just trigger a 404 error message and a program line number. It seems like there should be a more graceful way to handle that. And leo doesn’t seem prepared to handle more than a single word at a time, which is a pity.

Otherwise I could find no issues in the way leo handled my requests. I like the way the results are arranged, and aside from a few funny glitches when I tried to pipe the results of the English-to-German results back into leo for German-to-French translation (I hoped to get English-to-French in a roundabout way), I couldn’t find any errors.

Debian users have the luxury of installing just libwww-dict-leo-org-perl to get at the leo executable; Arch users can technically get it from AUR, but you will need to update the PKGBUILD files for both perl-www-dict-leo-org and perl-html-tableparser and update the former to the 1.39 version. (perl-html-tableparser will work at the listed version, but I flagged it as out-of-date anyway.) It’s not too difficult a task, if you have a few moments to spare. 😉

hey: More anti-aliasing

After my less-than flattering assessments of betty, I got a note about hey. hey behaves, more or less, in the same fashion as betty, but perhaps with the addition of an “interactive mode.”

2014-08-07-6m47421-hey

If you actually slogged through all the words I typed about betty, you’ll probably have a good guess at my opinion of hey. hey differs from betty on a few minor points, has its own list of identifiable commands, and might even handle scrambled word sequences better than betty.

But there’s not enough here to set apart hey from betty, and redeem either in the process. hey is doing much the same thing as betty — obfuscating some otherwise straightforward console commands (like the rename command, which would require much more typing than just mv) in the name of plain English.

hey has its own batch of idiosyncrasies, too. Just find file hey.py yields errors, unless the file name is enclosed in quotes. The command to download and compress the Google home page apparently worked satisfactorily, but yielded a file with a random name and no identifiable compression.

And while find me a restaurant did in fact open elinks to a list of restaurants in San Francisco, so did find me a laundromat. 🙄 Not to mention that I am not in San Francisco. 😐

I appreciate the efforts. hey and betty are about on par for me, but neither is the natural language interpreter it hopes to be. And neither is necessarily simplifying life at the console, so regardless of what you desire from betty or hey — whether it’s natural English comprehension or just an abbreviated console experience — I have the feeling you’ll walk away unsatisfied.

google-translate-cli: Mostly because it works

I haven’t seen a whole lot of CLI-level translation tools that impressed me much. But google-translate-cli seems to work very well, and doesn’t require extensive keyboard gymnastics to get results.

2014-08-06-6m47421-google-translate-cli

Enter just about any non-English string and you’ll get a translation straight from the Google hivemind, with the accompanying caveats about accuracy. That’s not the responsibility of google-translate-cli, of course; you should blame that on Big G.

Surprisingly (or perhaps not), google-translate-cli is just an awk script. If you’re expecting mongo dependencies to pull down the text, convert and format it, you’ll be disappointed. In fact, the AUR version built from git clocks in at a whopping 7.00KiB, if pacman -Qi is to be believed.

Pay close attention to the ins and outs of google-translate-cli. There are ways to convert to multiple languages, from multiple inputs, and to convert files directly — no need to pipe them or dump them.

I have no real complaints or suggestions for google-translate-cli; it satisfies me mostly because it works, but also because it does the job without sucking in dozens of dependencies or offering unnecessary flair. Clean, crisp, light and functional: Perfect. 🙂

P.S.: Why two programs from the G section today? I don’t know … because the gods ordained it. 🙄

betty: Anti-aliasing

I have two applications within a theme today; one of them I talked about a month ago on some other random site, and the other is relatively new. Or it is to me, anyway.

First up is betty.

2014-07-21-6m47421-betty

betty was steamrolling the Linux underbelly of the Internet for a while this summer, winning fans as a “Siri for the console.” Proponents suggested you could type just about any request of betty, and she would run the appropriate command and provide results. Rather than learning esoteric commands and flag sequences, betty could translate a request, pump it through the appropriate tool, and give you back an answer.

Which sounds like a fantastic idea, and I’m fully on board with betty … except as you can see above, it doesn’t quite work.

betty has preset commands she understands, most (all?) of which are listed on her home page. Deviate one character from those, and she’s lost.

Or worse, there are a few that supposedly work, that don’t. That’s what I hoped to show in the screenshot: that my typing skills were not to blame for betty’s empty replies.

I won’t harp too much on betty because I got most of my shots in last month, when fanboys hailed betty as The Golden Child of Linux and promised she would revolutionize life at the cursor. Suffice to say that betty doesn’t actually translate your commands, doesn’t parse context for a reply, and doesn’t tolerate deviation from her set list … hopefully.

Which means at best, betty works the opposite of an alias. Instead of just typing date +"%A", you’re typing in betty whats today, then sifting through her possible responses. If you hoped to save time typing, you didn’t.

And if you need to know the day of the week so frequently that you’d consider using betty for it, you’d do as well to use alias dow='date +"%A"', and do things the old-fashioned way.

But that’s enough for now. It will be a while before betty fulfills her promises, and becomes the natural language translator for the console. In that time, imagine how many traditional commands you could learn. … 😕