001    /*
002    NGramJ - n-gram based text classification
003    Copyright (C) 2001 Frank S. Nestel (frank at spieleck.de)
004    
005    This program is free software; you can redistribute it and/or modify
006    it under the terms of the GNU Lesser General Public License as published 
007    by the Free Software Foundation; either version 2.1 of the License, or
008    (at your option) any later version.
009    
010    This program is distributed in the hope that it will be useful,
011    but WITHOUT ANY WARRANTY; without even the implied warranty of
012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013    GNU General Public License for more details.
014    
015    You should have received a copy of the GNU Lesser General Public License
016    along with this program (lesser.txt); if not, write to the Free Software
017    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
018    */
019    
020    package de.spieleck.app.ngramj.phoner;
021    
022    import java.util.Hashtable;
023    
024    /**
025     * The "structure" of phone keys.
026     */
027    public class PhoneKeys
028    {
029        protected final static Hashtable replacers = new Hashtable(10);
030        static
031        {
032            replacers.put("1",new byte[]{(byte)'1'});
033            replacers.put("2",new byte[]{(byte)'2',(byte)'a',(byte)'b',(byte)'c'});
034            replacers.put("3",new byte[]{(byte)'3',(byte)'d',(byte)'e',(byte)'f'});
035            replacers.put("4",new byte[]{(byte)'4',(byte)'g',(byte)'h',(byte)'i'});
036            replacers.put("5",new byte[]{(byte)'5',(byte)'j',(byte)'k',(byte)'l'});
037            replacers.put("6",new byte[]{(byte)'6',(byte)'m',(byte)'n',(byte)'o'});
038            replacers.put("7",new byte[]{(byte)'7',(byte)'p',(byte)'q',(byte)'r',(byte)'s'});
039            replacers.put("8",new byte[]{(byte)'8',(byte)'t',(byte)'u',(byte)'v'});
040            replacers.put("9",new byte[]{(byte)'9',(byte)'w',(byte)'x',(byte)'y',(byte)'z'});
041            replacers.put("0",new byte[]{(byte)'0',(byte)' ',(byte)'.',(byte)'-'});
042        }
043    }
044