Abhishek Singh Bailoo

Weblog

Sep 17

T9 Source Code in Bash

You can download the source code from here

Shell Source code for T9

And the sample dictionary with T9 hashing for faster search from here

Sample Dictionary

The source code is reproduced below

#!/bin/bash
# This script still makes it simpler to implement the t9 by adapting the t9.dic
# Abhishek Singh Bailoo: 17th Sep, 2011

# Adapted from http://digitalpbk.blogspot.com/2008/07/trie-data-structure-c-t9.html
# The original comments are here
# bash script does something outrageous.
# It attempts to reproduce the T9 capability of the Mobile Phones !
# And does it in fewer commands than before!
# Adapted from Rahul’s Original T9.sh

if [ $# -eq 0 ] ; then
    echo “Usage : t9.sh <number string>”
    exit 1;
else  
    grep “^$1:” t9_mod.dic | cut -d: -f 2 | sort
fi