Phone Multi-tap Spelling
Ruby, 129 122 115 111 108 107 105

Done with golfing...

Oops, completely forgot to remove unnecessary spaces - fixed...

Saved 2 chars thanks to Peter Taylor.

Online version

def t9(t)
(t.tr(" ",?`).bytes.map{|c|"09998887777666555444333222"[96-c..-1][/(.)\1*/]}*' ').gsub /(\d) (?!\1)/,'\1'
end


Explanation:

space is translated to the char with the ordinal 96

(t.tr(" ",?`).bytes


characters are first mapped to series of numbers:
- a to 2
- b to 22
- d to 3222
- h to 444333222

a regex expression then matches the first group of equal digits

map{|c|"09998887777666555444333222"[96-c..-1][/(.)\1*/]}


the array is joined

*' ')


all spaces in the occurences of "digit space different_digit" are removed

gsub /(\d) (?!\1)/,'\1'