[Baypiggies] Using Google translate web page programmaticaly

Shannon -jj Behrens jjinux at gmail.com
Sun Mar 9 06:40:05 CET 2008


On Fri, Feb 29, 2008 at 12:23 AM, Kelly Yancey <kelly at nttmcl.com> wrote:
> Tony Cappellini wrote:
>  > Hello,
>  >
>  >
>  > Have any Baypiggies used the Google translate web page programmaticaly?
>  >
>  > I wish to access this url
>  >    * http://translate.google.com/translate_t?langpair=ja|en
>  >     (where the from language and to language may vary from request to request)
>  >    * submit a text string to be translated
>  >    * retrieve the translation or status indicating the translation was
>  > not possible.
>  >
>
>    I realize this is the opposite direction from what you asked, but
>  whenever I need English to Japanese translations, I just download Jim
>  Breen's edict dictionary file and use the following script:
>
>      import re
>
>      def stripAnnotations((ja, en)):
>         ja = re.sub('(?u)\s*\[.*\]\s*', '', ja)
>          en = re.sub('\s*\(.*\)\s*', '', en)
>         return (en, ja)
>
>      e2j = dict((
>               stripAnnotations(line.decode('euc-jp').split('/')[:2])
>               for line in open('edict').readlines() ))
>
>      def translateE2J(s):
>         return ''.join(filter(None, map(e2j.get, s.split())))
>
>    I've found this works just as well as, if not better than, Google
>  Translate or Babblefish(*).  I suspect the same technique will work for
>  Japanese to English translation too, once you get the minor issue of
>  word-splitting solved.
>
>    Kelly
>
>
>  (*) Assuming you are trying to produce entertaining jibberish, which I
>      assume you are.
>
>  ** This entire post is tongue-in-cheek.  Seriously, though, don't be
>     cheap: hire a professional to do your translations.  You'll be glad
>     you did.

I'd have to agree with Kelly.  If it's open source, get your users to
do it.  We had a lot of success with this approach at Foxmarks.  If
it's for pay, wait until you have some money, and then hire a service.
 I had success with this approach at IronPort.  It's not actually all
that expensive if you do as much setup work as possible.

The only drawback is that the professional companies seem not to know
anything about GNU gettext.  Apparently, they're only familiar with
Java property files :-/

Best Regards,
-jj

-- 
I, for one, welcome our new Facebook overlords!
http://jjinux.blogspot.com/


More information about the Baypiggies mailing list