Esempio n. 1
0
        void LoadRelativeKeyboardModel()
        {
            relativeKeyboardGaussianPair = new GaussianPair[ALPHABET_SIZE, ALPHABET_SIZE];
            StreamReader reader = new StreamReader("../../../Model/Relative-General-Keyboard.txt");
            string       line   = reader.ReadLine();

            string[] lineArray = line.Split('\t');
            double   xk        = double.Parse(lineArray[0]);
            double   xb        = double.Parse(lineArray[1]);
            double   xstddev   = double.Parse(lineArray[2]);
            double   yk        = double.Parse(lineArray[3]);
            double   yb        = double.Parse(lineArray[4]);
            double   ystddev   = double.Parse(lineArray[5]);

            for (int i = 0; i < ALPHABET_SIZE; ++i)
            {
                for (int j = 0; j < ALPHABET_SIZE; ++j)
                {
                    Point2D p = StandardPosition((char)(i + 'a')) - StandardPosition((char)(j + 'a'));
                    relativeKeyboardGaussianPair[i, j] = new GaussianPair(new Gaussian(p.x * xk + xb, xstddev), new Gaussian(p.y * yk + yb, ystddev));
                }
            }
            Console.WriteLine("Load relative keyboard GaussianPair : " + relativeKeyboardGaussianPair.Length);
            reader.Close();
        }
Esempio n. 2
0
        void LoadAbsoluteLetterModel()
        {
            absoluteLetterGaussianPair = new GaussianPair[26];
            StreamReader reader = new StreamReader("../../../Model/Absolute-General-Letter.txt");

            while (true)
            {
                string line = reader.ReadLine();
                if (line == null)
                {
                    break;
                }
                string[] lineArray = line.Split('\t');
                char     letter    = lineArray[0][0];
                Gaussian xD        = new Gaussian(double.Parse(lineArray[1]), double.Parse(lineArray[2]));
                Gaussian yD        = new Gaussian(double.Parse(lineArray[3]), double.Parse(lineArray[4]));
                absoluteLetterGaussianPair[letter - 'a'] = new GaussianPair(xD, yD);
            }
            Console.WriteLine("Load absolute letter GaussianPair : " + absoluteLetterGaussianPair.Length);
            reader.Close();
        }
 void LoadAbsoluteLetterModel()
 {
     absoluteLetterGaussianPair = new GaussianPair[26];
     StreamReader reader = new StreamReader("../../../Model/Absolute-General-Letter.txt");
     while (true)
     {
         string line = reader.ReadLine();
         if (line == null) break;
         string[] lineArray = line.Split('\t');
         char letter = lineArray[0][0];
         Gaussian xD = new Gaussian(double.Parse(lineArray[1]), double.Parse(lineArray[2]));
         Gaussian yD = new Gaussian(double.Parse(lineArray[3]), double.Parse(lineArray[4]));
         absoluteLetterGaussianPair[letter - 'a'] = new GaussianPair(xD, yD);
     }
     Console.WriteLine("Load absolute letter GaussianPair : " + absoluteLetterGaussianPair.Length);
     reader.Close();
 }
 void LoadRelativeKeyboardModel()
 {
     relativeKeyboardGaussianPair = new GaussianPair[ALPHABET_SIZE, ALPHABET_SIZE];
     StreamReader reader = new StreamReader("../../../Model/Relative-General-Keyboard.txt");
     string line = reader.ReadLine();
     string[] lineArray = line.Split('\t');
     double xk = double.Parse(lineArray[0]);
     double xb = double.Parse(lineArray[1]);
     double xstddev = double.Parse(lineArray[2]);
     double yk = double.Parse(lineArray[3]);
     double yb = double.Parse(lineArray[4]);
     double ystddev = double.Parse(lineArray[5]);
     for (int i = 0; i < ALPHABET_SIZE; ++i)
         for (int j = 0; j < ALPHABET_SIZE; ++j)
         {
             Point2D p = StandardPosition((char)(i + 'a')) - StandardPosition((char)(j + 'a'));
             relativeKeyboardGaussianPair[i, j] = new GaussianPair(new Gaussian(p.x * xk + xb, xstddev), new Gaussian(p.y * yk + yb, ystddev));
         }
     Console.WriteLine("Load relative keyboard GaussianPair : " + relativeKeyboardGaussianPair.Length);
     reader.Close();
 }