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.)


In reply to Re: unicode translation by graff
in thread unicode translation by ed111

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.