quiā possum

Translated from Latin to English:  “Because I can

I suppose that would be the written answer to the unspoken question, “So why are you writing an English-to-Latin translation program in JavaScript?”  Google Translate is usually okay at doing rough translations from almost any language to another. One that it can’t do well is Latin. I can attest that from the size and difficulty of the material in my new copy of Wheelock’s Latin that Google would be hard-pressed to achieve any sort of quality in their own attempts. It’s simply a difficult problem, to state things plainly.

People who attend college are asked to perform a variety of tasks which may ultimately seem like a waste of time. And in the big scheme of things so is this project. I doubt if anyone scholarly would want to use my translation tool. So why should I bother with it at all? I suppose the biggest reason would be to challenge myself to do something quite difficult. Problems like this demand that you sit down and think about the organization of the task at hand. This sort of training is good for software developers because it helps to train us how to organize code. Do you parse the English sentence down to words and then throw them at something that will translate each one in turn? Clearly, this looks to be the way that Google has approached the task and in the case of Latin it is destined to fail.

“Do you parse the English sentence down to words and then throw them at something that will translate each one in turn?”

The pitfalls of idioms

As a demonstration of an idiom I recall one of my first used cars. I bought it while stationed in Germany and it had a bumper sticker that was affixed to the inside door panel on the driver’s side. Its text in German was, “Sie nicht auf in die Luft gehen…” and it was accompanied by a cartoon man who was starting to accidentally float up somehow. If you attempt to use a word-by-word translation tool like Google you’re bound to be perplexed at the true meaning of the idiom “to go up in the air” which means the same as “to get mad” or “to get ruffled”, basically. In case you’re wondering, it’s from an old cigarette commercial from television which included the cartoon character. It’s likely it’s a play on the way cigarette smoke also goes up in the air. But if you were tasked to write a German-to-English translation tool then these sorts of things would be quite difficult unless you were a native speaker of German.

And yet, Latin’s a dead language. None of us grew up speaking it so this creates a lot of unfamiliarity.

It’s all in the approach

If you did have a dictionary of idioms, it would probably be best to translate those out of the sentence first and then finally attempt to translate the remaining individual words of the sentence. The earlier thought of parsing down to individual words and translating each is prone to fail as evidenced by many online translation sites. Perhaps a better approach is to look for the largest recognizable phrases and then progressively translate down, ad infinitum, as they’d say in Latin.

“Perhaps a better approach is to look for the largest recognizable phrases and then progressively translate down, ad infinitum, as they’d say in Latin.”

And yet, I’m just getting started. Eventually, I should be able to get to the point where the analyzer can determine person, number, tense, mood and voice from the entire sentence as submitted. With complete sentences, that’s often possible. But sometimes it’s not. Take for example:

"Go!"

Unless you’re the speaker or an observer to the scene, you’re missing a critical piece of information here: the number of people being directed. Without that, you can’t translate this second-person, present-tense, imperative, active verb to Latin. Unless you have all the attributes, you can’t accurately do the job.

Decisions, decisions…

You could take two different approaches if you don’t have all the required inputs: 1) don’t translate or 2) show all possible versions based upon any ambiguity. In the second case you might translate the singular and plural second-person conjugations of “to go”.

The approach that I’ve decided to take is to simply not translate if there are any unknowns. I have added options so that the end user may hint at what’s missing and this seems to be working out for now as I test things with short sentence fragments.

Keyboard fun

Latin includes vowels with macrons over them—these indicate long vowels. That said, it was an initial challenge to actually type them in. For my Mac computer I found that it was first necessary to change the keyboard driver itself (“ABC Extended”) to allow a keystroke combination such as the following:

Option-A, a -> ā
Option-A, e -> ē
Option-A, o -> ō

It seems to produce the required characters which display nicely out to the browser as expected.

Progress

Things are coming along well. I’ve created a Node Express project to display an HTML form to accept input. I think I’ve done a good job organizing the backend code (finally) in such a way that Node’s asynchronous idiosyncrasies behavior is taken into account. My first attempts began to oddly fail when I’d coded things sequentially and Node doesn’t allow that style of code organization.

So far, so good

Latin-screenshot

I may write more from time to time about this project here. I’m sure it will keep me busy for a while.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s