# HG changeset patch # User Igor Chubin # Date 1278239041 -7200 # Node ID 07d89c2505e75cf909e34388f6397250a9c618c7 # Parent c631833fa2bec0f2e8a1c85e50524696d5ac6cc0 lingvo en->ru by Andrii Grytsenko diff -r c631833fa2be -r 07d89c2505e7 en.sh --- a/en.sh Mon Jun 21 19:46:58 2010 +0300 +++ b/en.sh Sun Jul 04 12:24:01 2010 +0200 @@ -10,7 +10,8 @@ case $myname in "de") DICT_NAME=deu-eng ; DICTD_SERVER_ARGS='' - dict $DICTD_SERVER_ARGS -d "$DICT_NAME" "$@" + #dict $DICTD_SERVER_ARGS -d "$DICT_NAME" "$@" + sdcv -n "$@" ;; "pl") DICT_NAME=slovnyk_pl-ru dict $DICTD_SERVER_ARGS -d "$DICT_NAME" "$@" diff -r c631833fa2be -r 07d89c2505e7 lingvo-en-ru.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lingvo-en-ru.pl Sun Jul 04 12:24:01 2010 +0200 @@ -0,0 +1,49 @@ +#!/usr/bin/perl + +# written by Andrii Grytsenko, 2010 + +use Locale::Recode; +use LWP::UserAgent; +use strict; + + +sub parse_html { + my $text = shift; + my $result ; + $text =~ s/>\n]+>//g ; #delete all html tags + print "$line\n"; + } +} + + +my $cd = Locale::Recode->new (from => 'UTF-8', to => 'koi8-r'); +die $cd->getError if $cd->getError; +my $ua = LWP::UserAgent->new; +$ua->agent("Firefox/0.1 "); + +my $word = $ARGV[0]; +my $req = HTTP::Request->new(GET => "http://lingvo.abbyyonline.com/en/en-ru/$word"); + +my $res = $ua->request($req); + +if ($res->is_success) { + my $text = $res->content; + $cd->recode($text); # change code encoding from UTF-8 to koi8-ru + print "Translate for word $word\n"; + $text = parse_html($text); + print_html($text); +} else { + print $res->status_line, "\n"; +}