Speaking of I18N

I don’t suppose anyone has implemented any
kind of interface to babelfish? Something
like

string2 = babelfish(string, from_lang, to_lang)

by any chance?

I realize the results it gives are crude.

Hal

···


Hal Fulton
hal9000@hypermetrics.com

there is an example of this in soap4r, or
in soap4r one of the sample is this :slight_smile:

···

il Wed, 2 Jul 2003 04:59:05 +0900, “Hal E. Fulton” hal9000@hypermetrics.com ha scritto::

I don’t suppose anyone has implemented any
kind of interface to babelfish? Something
like

string2 = babelfish(string, from_lang, to_lang)

by any chance?

Hal E. Fulton wrote:

I don’t suppose anyone has implemented any
kind of interface to babelfish? Something
like

string2 = babelfish(string, from_lang, to_lang)

by any chance?

I realize the results it gives are crude.

Hal


Hal Fulton
hal9000@hypermetrics.com

I did a screen-scraping one some time back. It was truly a
several-minute hack. I put it in RAA under the “Jokes” category, but I
don’t think it works anymore (since I depended on the HTML output of
babelfish for it to work). I should probably either fix it or remove
it, though I guess being under the Joke category, it’s not going to have
a huge impact on RAA’s credibility. :slight_smile:

I also had a method called “stupidize”, which would translate text to
and from a language, allowing it to suffer the often hilarious semantic
distortion that you get from Babelfish.

Chad

On the ‘ruby developers guide’, there is an exemple which do it

require ‘soap/driver’

result = driver.BabelFish(lang, input.read)

gabriele renzi wrote:

···

il Wed, 2 Jul 2003 04:59:05 +0900, “Hal E. Fulton” >hal9000@hypermetrics.com ha scritto::

I don’t suppose anyone has implemented any
kind of interface to babelfish? Something
like

string2 = babelfish(string, from_lang, to_lang)

by any chance?

there is an example of this in soap4r, or
in soap4r one of the sample is this :slight_smile:

I don’t suppose anyone has implemented any
kind of interface to babelfish? Something
like

string2 = babelfish(string, from_lang, to_lang)

by any chance?

there is an example of this in soap4r, or
in soap4r one of the sample is this :slight_smile:

Thank you, I will look at that.

Hal

···

----- Original Message -----
From: “gabriele renzi” surrender_it@rc1.vip.lng.yahoo.com
Newsgroups: comp.lang.ruby
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Tuesday, July 01, 2003 3:11 PM
Subject: Re: Speaking of I18N…

il Wed, 2 Jul 2003 04:59:05 +0900, “Hal E. Fulton” > hal9000@hypermetrics.com ha scritto::


Hal Fulton
hal9000@hypermetrics.com

That hilarious semantic distortion is also interesting
in a theoretical sense (to me, at least). I find myself
sometimes wondering if there might be a way to measure
the drift in meaning – I tend to think that a one-way
translation is probably only “half as garbled” (whatever
that means!) as a two-way one.

But if that’s true, it implies there must be some way
to quantify it – or else my thinking is just nonsense.
And then that raises issues like: If I translate something
from English to German and then back again, is more meaning
lost on the first leg of that trip or the second leg? Is it
different translating lang X to lang Y for different values
of X and Y? It would have to be, I think.

But I’ve wandered offtopic, as I do so well.

I’ll check out the SOAP4R thing.

Hal

···

----- Original Message -----
From: “Chad Fowler” chadfowler@chadfowler.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Tuesday, July 01, 2003 5:53 PM
Subject: Re: Speaking of I18N…

I did a screen-scraping one some time back. It was truly a
several-minute hack. I put it in RAA under the “Jokes” category, but I
don’t think it works anymore (since I depended on the HTML output of
babelfish for it to work). I should probably either fix it or remove
it, though I guess being under the Joke category, it’s not going to have
a huge impact on RAA’s credibility. :slight_smile:

I also had a method called “stupidize”, which would translate text to
and from a language, allowing it to suffer the often hilarious semantic
distortion that you get from Babelfish.


Hal Fulton
hal9000@hypermetrics.com

Well, the screen-scraper might be a lightweight option…
the one with soap4r works great, but I had to install:

  • soap4r
  • rexml
  • http-access2
  • devel-logger

And I’m not sure any of these work with raa-install. I thought
the first one was working… but I couldn’t find any of the
samples and such, unless I installed manually. And I had to do
them one at a time, since I could only discover dependencies
by the “run and crash” method.

Or to be fair, it might be in the docs. :slight_smile: :slight_smile:

Is raa-install currently healthy? It’s supposed to be self-updating,
but “raa-install -i raa-install” doesn’t work for me.

Cheers,
Hal

···

----- Original Message -----
From: “Chad Fowler” chadfowler@chadfowler.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Tuesday, July 01, 2003 5:53 PM
Subject: Re: Speaking of I18N…

Hal E. Fulton wrote:

I don’t suppose anyone has implemented any
kind of interface to babelfish? Something
like

I did a screen-scraping one some time back. It was truly a
several-minute hack. I put it in RAA under the “Jokes” category, but I
don’t think it works anymore (since I depended on the HTML output of
babelfish for it to work). I should probably either fix it or remove
it, though I guess being under the Joke category, it’s not going to have
a huge impact on RAA’s credibility. :slight_smile:


Hal Fulton
hal9000@hypermetrics.com

I am having trouble tracking down the point at which my program is
failing. I have a backtrace that looks like this:

/usr/local/lib/ruby/1.6/net/protocol.rb:468:in new': wrong argument type nil (expected String) (TypeError) from /usr/local/lib/ruby/1.6/net/protocol.rb:468:inconnect’
from /usr/local/lib/ruby/1.6/net/protocol.rb:467:in timeout' from /usr/local/lib/ruby/1.6/net/protocol.rb:467:inconnect’
from /usr/local/lib/ruby/1.6/net/protocol.rb:449:in initialize' from /usr/local/lib/ruby/1.6/net/protocol.rb:149:innew’
from /usr/local/lib/ruby/1.6/net/protocol.rb:149:in
conn_socket' from /usr/local/lib/ruby/1.6/net/http.rb:499:indo_start’
from /usr/local/lib/ruby/1.6/net/protocol.rb:131:in start' ... 6 levels... from webcount.rb:556:ineach’
from webcount.rb:556:in wayback' from webcount.rb:703:indosite’
from webcount.rb:813

What I need to know are which lines of code are represented by “… 6
levels…”. Is there any way of stopping ruby from abbreviating the
backtrace like this?

(I’m using ruby 1.6.8 (2002-12-24) [powerpc-darwin6.6])

Thanks

Nigel

I should have known this… I have had that book
for a long time.

Thanks,
Hal

···

----- Original Message -----
From: “Bermejo, Rodrigo” rodrigo.bermejo@ps.ge.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Tuesday, July 01, 2003 4:28 PM
Subject: Re: Speaking of I18N…

On the ‘ruby developers guide’, there is an exemple which do it

require ‘soap/driver’

result = driver.BabelFish(lang, input.read)


Hal Fulton
hal9000@hypermetrics.com

It is the default exception handling in Ruby. You can always embrace your
program
in

begin

rescure Exception => exception
p exception.message
p exception.backtrace # or present it in any other way you like
end

Gennady

···

----- Original Message -----
From: “Nigel Gilbert” n.gilbert@soc.surrey.ac.uk
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Wednesday, July 02, 2003 2:43 PM
Subject: More error backtrace

I am having trouble tracking down the point at which my program is
failing. I have a backtrace that looks like this:

/usr/local/lib/ruby/1.6/net/protocol.rb:468:in new': wrong argument type nil (expected String) (TypeError) from /usr/local/lib/ruby/1.6/net/protocol.rb:468:in connect’
from /usr/local/lib/ruby/1.6/net/protocol.rb:467:in timeout' from /usr/local/lib/ruby/1.6/net/protocol.rb:467:in connect’
from /usr/local/lib/ruby/1.6/net/protocol.rb:449:in initialize' from /usr/local/lib/ruby/1.6/net/protocol.rb:149:in new’
from /usr/local/lib/ruby/1.6/net/protocol.rb:149:in
conn_socket' from /usr/local/lib/ruby/1.6/net/http.rb:499:in do_start’
from /usr/local/lib/ruby/1.6/net/protocol.rb:131:in start' ... 6 levels... from webcount.rb:556:in each’
from webcount.rb:556:in wayback' from webcount.rb:703:in dosite’
from webcount.rb:813

What I need to know are which lines of code are represented by “… 6
levels…”. Is there any way of stopping ruby from abbreviating the
backtrace like this?

(I’m using ruby 1.6.8 (2002-12-24) [powerpc-darwin6.6])

Thanks

Nigel

in eval.c:

#define TRACE_MAX (TRACE_HEAD+TRACE_TAIL+5)
#define TRACE_HEAD 8
#define TRACE_TAIL 5

So you could change those constants. But easier, wrap your code in something
like this:

begin
… do your code
rescue Exception => e
puts “#{e} (#{e.class})\n#{e.backtrace.join(”\n")}"
end

Regards,

Brian.

···

On Thu, Jul 03, 2003 at 06:43:03AM +0900, Nigel Gilbert wrote:

What I need to know are which lines of code are represented by “… 6
levels…”. Is there any way of stopping ruby from abbreviating the
backtrace like this?

What I need to know are which lines of code are represented by “… 6
levels…”. Is there any way of stopping ruby from abbreviating the
backtrace like this?

You will need to catch ALL exceptions yourself… like this:

ruby x.rb
Fatal-Error in program!
please report this bug.
EXCEPTION:
RuntimeError
MESSAGE:
hello world
BACKTRACE:
x.rb:2

cat x.rb
begin
raise “hello world”
rescue Exception => e
puts <<MSG
Fatal-Error in program!
please report this bug.
EXCEPTION:
\t#{e.class.to_s}
MESSAGE:
\t#{e.message}
BACKTRACE:
#{e.backtrace.map{|t|“\t#{t}\n”}.join}
MSG
end

···

On Thu, 03 Jul 2003 07:43:03 +0900, Nigel Gilbert wrote:


Simon Strandgaard

Not having seen your code, and therefore ignorant, why is the above not
sufficient to diagnose the problem?

Regards,

Mark Wilson

···

On Wednesday, July 2, 2003, at 05:43 PM, Nigel Gilbert wrote:

I am having trouble tracking down the point at which my program is
failing. I have a backtrace that looks like this:

/usr/local/lib/ruby/1.6/net/protocol.rb:468:in new': wrong argument type nil (expected String) (TypeError) from /usr/local/lib/ruby/1.6/net/protocol.rb:468:in connect’
[snip]

Typo correction: rescure → rescue

···

----- Original Message -----
From: “Gennady” gfb@tonesoft.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Wednesday, July 02, 2003 2:51 PM
Subject: Re: More error backtrace

It is the default exception handling in Ruby. You can always embrace your
program
in

begin

rescure Exception => exception
p exception.message
p exception.backtrace # or present it in any other way you like
end

Gennady

----- Original Message -----
From: “Nigel Gilbert” n.gilbert@soc.surrey.ac.uk
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Wednesday, July 02, 2003 2:43 PM
Subject: More error backtrace

I am having trouble tracking down the point at which my program is
failing. I have a backtrace that looks like this:

/usr/local/lib/ruby/1.6/net/protocol.rb:468:in new': wrong argument type nil (expected String) (TypeError) from /usr/local/lib/ruby/1.6/net/protocol.rb:468:in connect’
from /usr/local/lib/ruby/1.6/net/protocol.rb:467:in timeout' from /usr/local/lib/ruby/1.6/net/protocol.rb:467:in connect’
from /usr/local/lib/ruby/1.6/net/protocol.rb:449:in
initialize' from /usr/local/lib/ruby/1.6/net/protocol.rb:149:in new’
from /usr/local/lib/ruby/1.6/net/protocol.rb:149:in
conn_socket' from /usr/local/lib/ruby/1.6/net/http.rb:499:in do_start’
from /usr/local/lib/ruby/1.6/net/protocol.rb:131:in start' ... 6 levels... from webcount.rb:556:in each’
from webcount.rb:556:in wayback' from webcount.rb:703:in dosite’
from webcount.rb:813

What I need to know are which lines of code are represented by “… 6
levels…”. Is there any way of stopping ruby from abbreviating the
backtrace like this?

(I’m using ruby 1.6.8 (2002-12-24) [powerpc-darwin6.6])

Thanks

Nigel

I’ve been wondering for some time why it did this.

Just curious, what’s the rationale for truncating it?

-Tom

···

On Wed, 2003-07-02 at 17:57, Brian Candler wrote:

On Thu, Jul 03, 2003 at 06:43:03AM +0900, Nigel Gilbert wrote:

What I need to know are which lines of code are represented by “… 6
levels…”. Is there any way of stopping ruby from abbreviating the
backtrace like this?

in eval.c:

#define TRACE_MAX (TRACE_HEAD+TRACE_TAIL+5)
#define TRACE_HEAD 8
#define TRACE_TAIL 5

So you could change those constants. But easier, wrap your code in something
like this:

begin
… do your code
rescue Exception => e
puts “#{e} (#{e.class})\n#{e.backtrace.join(”\n")}"
end

Regards,

Brian.

I always assumed it was to save space. Does it
do it when the levels are unique? I’ve personally
only seen it when there’s a recursion problem and
thus a stack overflow. In a case like that, there’s
no loss of information.

Hal

···

----- Original Message -----
From: “Tom Clarke” tom@u2i.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Wednesday, July 02, 2003 6:00 PM
Subject: Re: More error backtrace

I’ve been wondering for some time why it did this.

Just curious, what’s the rationale for truncating it?


Hal Fulton
hal9000@hypermetrics.com

-Tom

On Wed, 2003-07-02 at 17:57, Brian Candler wrote:

On Thu, Jul 03, 2003 at 06:43:03AM +0900, Nigel Gilbert wrote:

What I need to know are which lines of code are represented by “… 6
levels…”. Is there any way of stopping ruby from abbreviating the
backtrace like this?

in eval.c:

#define TRACE_MAX (TRACE_HEAD+TRACE_TAIL+5)
#define TRACE_HEAD 8
#define TRACE_TAIL 5

So you could change those constants. But easier, wrap your code in
something
like this:

begin
… do your code
rescue Exception => e
puts “#{e} (#{e.class})\n#{e.backtrace.join(”\n")}"
end

Regards,

Brian.

No, at least not in 1.6.8:

#define TRACE_MAX (TRACE_HEAD+TRACE_TAIL+5)
#define TRACE_HEAD 8
#define TRACE_TAIL 5

    ep = RARRAY(errat);
    for (i=1; i<ep->len; i++) {
        if (TYPE(ep->ptr[i]) == T_STRING) {
            fprintf(stderr, "\tfrom %s\n", RSTRING(ep->ptr[i])->ptr);
        }
        if (i == TRACE_HEAD && ep->len > TRACE_MAX) {
            fprintf(stderr, "\t ... %ld levels...\n",
                    ep->len - TRACE_HEAD - TRACE_TAIL);
            i = ep->len - TRACE_TAIL;
        }
    }
}

}

i.e. it shows just the first 8 lines and the last 5 lines.

Cheers,

Brian.

···

On Thu, Jul 03, 2003 at 08:39:26AM +0900, Hal E. Fulton wrote:

Just curious, what’s the rationale for truncating it?

I always assumed it was to save space. Does it
do it when the levels are unique?