Phone number to words

Discussion in 'Ruby' started by Jordi Bunster, Feb 10, 2005.

  1. 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. ;)

    --
    Jordi
    Jordi Bunster, Feb 10, 2005
    #1
    1. Advertising

  2. Jordi Bunster

    Bill Guindon Guest

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


    On Thu, 10 Feb 2005 09:14:14 +0900, Jordi Bunster <> wrote:
    > 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. ;)
    >
    > --
    > Jordi
    >
    >



    --
    Bill Guindon (aka aGorilla)
    Bill Guindon, Feb 10, 2005
    #2
    1. Advertising

  3. Jordi Bunster

    Joe Van Dyk Guest

    On Thu, 10 Feb 2005 09:26:39 +0900, Bill Guindon <> wrote:
    > Sounds like it would make a good ruby quiz, and Friday's coming.
    >
    >
    > On Thu, 10 Feb 2005 09:14:14 +0900, Jordi Bunster <> wrote:
    > > 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. ;)
    > >


    Heck yeah, that would be a great one. I'd actually do it. :)
    Joe Van Dyk, Feb 10, 2005
    #3
  4. Jordi Bunster wrote:
    > 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. ;)
    >
    > --
    > Jordi
    >
    >
    >


    Do you mean something like:

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

    ? :)

    --
    Sz
    Szymon Drejewicz, Feb 10, 2005
    #4
  5. Hi,

    Am Donnerstag, 10. Feb 2005, 09:26:39 +0900 schrieb Bill Guindon:
    > On Thu, 10 Feb 2005 09:14:14 +0900, Jordi Bunster <> wrote:
    > > Does anyone have one of those algorithms that convert a phone number to
    > > a word, using /usr/share/dict/words, for example?

    >
    > 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


    --
    Bertram Scharpf
    Stuttgart, Deutschland/Germany
    http://www.bertram-scharpf.de
    Bertram Scharpf, Feb 10, 2005
    #5
  6. Hi --

    On Thu, 10 Feb 2005, Bertram Scharpf wrote:

    > Hi,
    >
    > Am Donnerstag, 10. Feb 2005, 09:26:39 +0900 schrieb Bill Guindon:
    >> On Thu, 10 Feb 2005 09:14:14 +0900, Jordi Bunster <> wrote:
    >>> Does anyone have one of those algorithms that convert a phone number to
    >>> a word, using /usr/share/dict/words, for example?

    >>
    >> 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

    --
    David A. Black
    David A. Black, Feb 10, 2005
    #6
  7. Jordi Bunster

    Tom Rathbone Guest

    > > On Thu, 10 Feb 2005 09:14:14 +0900, Jordi Bunster <> wrote:
    > > 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. ;)
    > >
    > > --
    > > Jordi
    > >
    > >

    > On Thu, 10 Feb 2005 09:26:39 +0900, Bill Guindon <> wrote:
    > Sounds like it would make a good ruby quiz, and Friday's coming.
    > --
    > Bill Guindon (aka aGorilla)


    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.
    Tom Rathbone, Feb 10, 2005
    #7
  8. On Feb 10, 2005, at 6:27 AM, David A. Black wrote:

    > 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.

    --
    Jordi
    Jordi Bunster, Feb 10, 2005
    #8
  9. On Feb 10, 2005, at 4:32 AM, Tom Rathbone wrote:
    > [...] 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.
    Gavin Kistner, Feb 10, 2005
    #9
  10. On Feb 9, 2005, at 7:19 PM, Joe Van Dyk wrote:

    > On Thu, 10 Feb 2005 09:26:39 +0900, Bill Guindon <>
    > wrote:
    >> Sounds like it would make a good ruby quiz, and Friday's coming.
    >>
    >>
    >> On Thu, 10 Feb 2005 09:14:14 +0900, Jordi Bunster <>
    >> wrote:
    >>> 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. ;)
    >>>

    >
    > 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
    James Edward Gray II, Feb 10, 2005
    #10
  11. On Thu, 10 Feb 2005 23:21:17 +0900, Thomas Counsell <> wrote:
    > ** 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
    --
    Austin Ziegler *
    * Alternate:
    Austin Ziegler, Feb 10, 2005
    #11
  12. Hi,

    Am Donnerstag, 10. Feb 2005, 21:42:47 +0900 schrieb Jordi Bunster:
    > On Feb 10, 2005, at 6:27 AM, David A. Black wrote:
    >
    > >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


    --
    Bertram Scharpf
    Stuttgart, Deutschland/Germany
    http://www.bertram-scharpf.de
    Bertram Scharpf, Feb 10, 2005
    #12
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Strøiman
    Replies:
    1
    Views:
    2,064
    Peter Strøiman
    Aug 23, 2005
  2. Zahoor
    Replies:
    1
    Views:
    790
    Darryl L. Pierce
    Nov 15, 2003
  3. Richard Heathfield
    Replies:
    7
    Views:
    346
    Barry Schwarz
    Oct 5, 2003
  4. chen selina
    Replies:
    0
    Views:
    866
    chen selina
    Jul 7, 2010
  5. Rene Ivon Shamberger

    convert Phone Letters to Phone numbers

    Rene Ivon Shamberger, Dec 4, 2012, in forum: C++
    Replies:
    5
    Views:
    357
Loading...

Share This Page