looking for a quick way in for english-spanish translator
jdawg
jdawgaz at cox.net
Sun Nov 9 21:54:44 MST 2008
Ryan Rix wrote:
> I'm not sure if it's been put in but what about dictd?
> aptitude install dict-freedict-eng-spa dict dictd
> then from the command line:
> dict -d fd-eng-spa [word]
> and it will return the word you wanted, found in the spanish dictionary...
>
Ryan, thanks for the tip.
but this doesn't work too well.
are there any better databases anywhere?
I did something simple, but the database is not very good.
dict -d fd-spa-eng hola
No definitions found for "hola", perhaps you mean:
fd-spa-eng: ola
I can't even translate hola (hello)
So I think I will do the other route.
Jerry
> --
> Thanks and best regards,
> Ryan Rix
> TamsPalm - The PalmOS Blog
>
> And just when you thought you've seen it all, along comes a
> Lambda four foot tall
>
>
>
>
> On Sun November 9 2008 09:29:03 pm jdawg wrote:
>
>> Tuna wrote:
>>
>>>> Kurt Granroth wrote:
>>>>
>>>>> jdawg wrote:
>>>>>
>>>>>> I am wanting to do a quick way to get english-spanish/spanish-english
>>>>>> translation ultimately from the command line.
>>>>>>
>>>>>> As a first step, I tried this:
>>>>>> wget 'http://translate.google.com/translate_t#es|en|pavimentado'
>>>>>>
>>>>>> and I got this back:
>>>>>> ---------- error -----------
>>>>>> --08:49:36-- http://translate.google.com/translate_t
>>>>>> => `translate_t'
>>>>>> Resolving translate.google.com... 74.125.95.113, 74.125.95.100,
>>>>>> 74.125.95.101, ...
>>>>>> Connecting to translate.google.com|74.125.95.113|:80... connected.
>>>>>> HTTP request sent, awaiting response... 403 Forbidden
>>>>>> 08:49:41 ERROR 403: Forbidden.
>>>>>> ---------- end of error ----------
>>>>>>
>>>>>> So does anyone know a site where I can do this kind of thing. all the
>>>>>> ones I have found so far, won't let you do it.
>>>>>>
>>>>> The output for that would be tricky to handle, even if it did work,
>>>>> since that URL returns a fully formatted HTML page. You would have to
>>>>> do a lot of HTML parsing from the command line.
>>>>>
>>>>> A far better route would be to use the Google API.
>>>>>
>>>>> http://code.google.com/apis/ajaxlanguage/documentation/
>>>>>
>>>>> The docs they have there are all Javascript specific, but at the core,
>>>>> it's all just JSON formatted requests and responses over HTTP. 'wget'
>>>>> and 'sed' should be able to make quick work of them. If not, maybe you
>>>>> could create a couple line perl wrapper?
>>>>>
>>>>> Here's some example uses of the Google API (not the language one, but
>>>>> the concept is identical) in other languages:
>>>>>
>>>>> http://code.google.com/apis/ajaxsearch/documentation/index.html#fonje_s
>>>>> nippets
>>>>>
>>>> And, to follow up to myself, here is an example using curl and sed.
>>>> wget works just as well... I used curl here only because it's one
>>>> command line option easier to output to stdout:
>>>>
>>>> $ curl --silent
>>>> "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=hel
>>>> lo&langpair=en%7Ces"
>>>>
>>>> | sed -e 's,^.*translatedText":",,g' -e 's,"}.*$,,g'
>>>>
>>>> hola
>>>>
>>>> Kurt
>>>>
>>> My friend wrote a python script that does all this. Some IRC'ers in here
>>> will remember bobsalad, he uses this script now.
>>>
>>> http://www.coderprofile.com/networks/source-codes/521/google-translator-s
>>> cript
>>>
>>> ---------------------------------------------------
>>> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
>>> To subscribe, unsubscribe, or to change your mail settings:
>>> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>>>
>> haven't had much to do with python yet (turned off by the block
>> indentation thing), mostly a perl and bash guy.
>> but I thank you for the url of above. this is what I really hoped for.
>>
>> something like this works just fine
>> i will write my own bash script to translate all kinds of text using
>> this technique.
>>
>> it works as expected in the other direction:
>>
>> curl --silent
>> "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=pavime
>> ntada%20primario&langpair=es%7Cen"
>>
>> jerry
>>
>
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
--
Happy Trails!
Jerry (K7AZJ)
Hobbit Name: Pimpernel Loamsdown
Registered Linux User: 275424
This email's random fortune:
More information about the PLUG-discuss
mailing list