Bash: T9 simulator (intuitive text phone)

paul0007 Posted messages 5 Status Member -  
 Anonymous user -
Hello,

I'm looking to create a T9 simulator

So I need to write a Bash script that converts text to numbers and vice versa.

Could you please suggest a solution?

2 answers

  1. Anonymous user
     
    Hi,

    Do you have a beginning of an algorithm?
    How does T9 work?
    An example of text and the corresponding numbers for the transformation of the text?

    There is still a minimum of research and explanations to provide before anyone helps you!
    0
    1. paul0007 Posted messages 5 Status Member 1
       
      Hello,
      I have defined the different possible combinations

      a = 2
      b = 22
      c = 222
      d = 3
      e = 33
      f = 333
      g = 4
      h = 44
      i = 444
      j = 5
      k = 55
      l = 555
      m = 6
      n = 66
      o = 666
      p = 7
      q = 77
      r = 777
      s = 7777
      t = 8
      u = 88
      v = 888
      w = 9
      x = 99
      y = 999
      z =9999

      However, I have no idea for the code (I just started with bash..), I was thinking of using tr.
      Can you help me?
      1
    2. paul0007 Posted messages 5 Status Member 1
       
      but with tr it's one letter by one letter so I don't see how to transform the b into 22
      0
    3. paul0007 Posted messages 5 Status Member 1
       
      ah .. or we can shorten it by saying that:
      2 = a, b, c
      3 = c, d, e
      4 = f, h, i
      5 = j, k, l
      6 = m, n, o
      7 = p, q, r, s
      8 = t, u, v
      9 = w, x, y, z

      ?
      0