in reply to unicode translation

There is a tool written in perl (with associated dictionary tables) available for free on request (you have to ask for it -- you can't just download it). Send email to ldc (at) ldc.upenn.edu saying that you want the Buckwalter Arabic Morphological Analyzer (BAMA) Version 1 (LDC catalog-ID "LDC2002L49"). The name comes from the person who invented the tool and maintained it for many years, Tim Buckwalter.

Once you have that tool in place on your machine, you need to convert your Arabic text from unicode to cp1256 (that version of the tool only accepts that encoding) and pipe the text as input to the "AraMorph.pl" script. The output will be a list of possible "interpretations" for each word, including part-of-speech tags, segmentation into stems and affixes, and English glosses.

Bear in mind that most Arabic words (as written in Arabic characters) are incredibly ambiguous, due in part to the fact that the words are normally written without the marks that indicate vowels and lengthened consonants, so getting an English translation for a given word is fairly speculative for those who don't know both Arabic and English.

If the "unicode" you are talking about is utf8, then "unicode English" is no different from "ascii English", because the ascii character set is a subset of utf8-encoded unicode. If you have utf-16, that's very different, because each ascii byte needs to have a null "high byte" to pad it out to 16 bits.

As for doing encoding conversions, perl makes that pretty easy. If you are starting with utf8 Arabic, and want to feed the "AraMorph.pl" tool described above, this would suffice:

perl -e 'binmode STDIN,":utf8";binmode STDOUT,":encoding(cp1256)";prin +t while(<>)' < arabic.utf8 | AraMorph.pl > output
If you're data is in some other form of unicode (not utf8), just change the 'binmode STDIN' part as needed.

You'll want to consult the BAMA docs for more information about the tool and its output. (Update: since the previous reply mentioned dialects, I should point out that BAMA works only on Modern Standard Arabic, not any colloquial dialect, but that's generally not a problem, since the vast majority of writing in Arabic involves MSA.)

Replies are listed 'Best First'.
Re^2: unicode translation
by Marshall (Canon) on May 28, 2009 at 06:43 UTC
    Fantastic Post!

    I think the poster will definitely need a helper (doesn't have to a programmer), just somebody who speaks both languages or this could be a real problem. I don't know much at all about Arabic but I do hear this this "missing vowel sort of stuff" can be very difficult.

    I used to help a friend go from German to English. She was certified in the German courts to go from English to German, but the other direction was more problematic! What she came up with was understandable to be sure! But not the way a native English language speaker would formulate or say it. This translation stuff has many pitfalls.

    Update:
    At little at the edges of the topic, but once I was trying to read an instruction manual. This was a German product that got licensed to a Japanese company who evidently translated the manual into Japanese, and then into English. I could easily understand the German, but the English was just gibberish to me! I'm just saying that translation is a tricky business.

Re^2: unicode translation
by Anonymous Monk on Jun 10, 2009 at 00:45 UTC
    I have been on a trip and just got back. Thanks for the reponses-good stuff.
      Two further questions: I sent e-mail to the e-mail address you listed and requested BAMA but never heard back. Any other ideas on how I could get a copy of BAMA? Second question: I have a new task and that is to translate URL endoed strings to Arabic and then to English? Any suggestions?
        Hi
        you can find it here:
        http://www.ling.ohio-state.edu/~jonsafari/arabiclg/bin/