Phone number to words

J

Jordi Bunster

Does anyone have one of those algorithms that convert a phone number to
a word, using /usr/share/dict/words, for example?

In Ruby, I mean. ;)
 
S

Szymon Drejewicz

Jordi said:
Does anyone have one of those algorithms that convert a phone number to
a word, using /usr/share/dict/words, for example?

In Ruby, I mean. ;)

Do you mean something like:

Speaker.say('888 999 123')
=> eight eight eight nine nine nine one two three

? :)
 
B

Bertram Scharpf

Hi,

Am Donnerstag, 10. Feb 2005, 09:26:39 +0900 schrieb Bill Guindon:
Sounds like it would make a good ruby quiz, and Friday's coming.

words = %w(zero one two ...)
number.scan( /[0-9]/).map { |x| words[ x.to_i] }.join ' '

A nice quiz would be saying numbers in French.

Bertram
 
D

David A. Black

Hi --

Hi,

Am Donnerstag, 10. Feb 2005, 09:26:39 +0900 schrieb Bill Guindon:
Sounds like it would make a good ruby quiz, and Friday's coming.

words = %w(zero one two ...)
number.scan( /[0-9]/).map { |x| words[ x.to_i] }.join ' '


I don't think that's what Jordi meant. I think it's more like:
convert the numbers to their letter equivalents (2 => a,b,c; 3 =>
d,e,f; etc. [in the U.S.]), and then see what words you can spell.

Just for fun, though, here's another way to do yours:

require 'scanf'
number.scanf("%1d") {|n,| words[n] }.join(" ")


David
 
T

Tom Rathbone

Sounds like it would make a good ruby quiz, and Friday's coming.

I recently wrote a challenge/quiz for www.osix.net (a nice little
challenge site.. good place to strut your ruby) it hasn't been
released yet but will be shortly. The challenge to to decode a string
of telephone keypresses to words as if composing a message using
predictive-text (T9). Is this what you meant? If so could I ask that
it is held off as a ruby quiz until our challenge has run its course
and the prize winners are announced, release is any day now, runs for
one month.

Tom.

P.S I wrote the original converted in Ruby.. very easy.
 
J

Jordi Bunster

I don't think that's what Jordi meant. I think it's more like:
convert the numbers to their letter equivalents (2 => a,b,c; 3 =>
d,e,f; etc. [in the U.S.]), and then see what words you can spell.

Exactly. 1-800-SUETHEM and the like.
 
G

Gavin Kistner

[...] The challenge to to decode a string
of telephone keypresses to words as if composing a message using
predictive-text (T9). Is this what you meant?

No, I believe the OP was just looking for "what fun and memorable
phrase can I tell people to use for my phone number?", not T9.
 
J

James Edward Gray II

Heck yeah, that would be a great one. I'd actually do it. :)

You guys know how this system works by now, don't you? :) It somebody
puts a write-up I can use in my inbox, I promise, it'll happen.

I'm currently empty on submitted quizzes too, so the more ideas the
better. Send it in.

James Edward Gray II
 
A

Austin Ziegler

** I've just had a sudden doubt that T9 has a standardised number to
letter map...

Yes. Q is on 7 and Z is on 9. Beyond that, it's the standard telephone key map.

-austin
 
B

Bertram Scharpf

Hi,

Am Donnerstag, 10. Feb 2005, 21:42:47 +0900 schrieb Jordi Bunster:
I don't think that's what Jordi meant. I think it's more like:
convert the numbers to their letter equivalents (2 => a,b,c; 3 =>
d,e,f; etc. [in the U.S.]), and then see what words you can spell.

Exactly. 1-800-SUETHEM and the like.

Seems to be no real challenge either.
<http://projects.bertram-scharpf.de/tmp/phonetoword.rb>

What happens to the 0 and 1 digits?

Bertram
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top