Beispiel #1
0
        private static bool turkishNeedCorrection(string c, int point)
        {
            string ch = c;

            string tr = TurkishDowncaseAsciifyTable.ContainsKey(ch) ? TurkishDowncaseAsciifyTable[ch] : null;

            if (tr == null)
            {
                tr = ch;
            }

            Dictionary <string, int> pl = TurkishPattern.ContainsKey(tr.ToLower(CultureInfo.GetCultureInfo("en-GB"))) ? TurkishPattern[tr.ToLower(CultureInfo.GetCultureInfo("en-GB"))] : null;

            bool m = false;

            if (pl != null)
            {
                m = turkishMatchPattern(pl, point);
            }

            if (tr.Equals("I"))
            {
                if (ch.Equals(tr))
                {
                    return(!m);
                }
                else
                {
                    return(m);
                }
            }
            else
            {
                if (ch.Equals(tr))
                {
                    return(m);
                }
                else
                {
                    return(!m);
                }
            }
        }
Beispiel #2
0
        private static string turkishGetContext(int size, int point)
        {
            string s = repeatString(" ", (1 + (2 * size)));

            s = setCharAt(s, size, "X");

            int  i     = size + 1;
            bool space = false;
            int  index = point;

            index++;

            string currentChar;

            while (i < s.Length && !space && index < asciiString.Length)
            {
                currentChar = turkishString[index].ToString();

                string x = TurkishDowncaseAsciifyTable.ContainsKey(currentChar) ? TurkishDowncaseAsciifyTable[currentChar] : null;

                if (x == null)
                {
                    if (!space)
                    {
                        i++;
                        space = true;
                    }
                }
                else
                {
                    s = setCharAt(s, i, x);
                    i++;
                    space = false;
                }
                index++;
            }

            s = s.Substring(0, i);

            index = point;
            i     = size - 1;
            space = false;

            index--;

            while (i >= 0 && index >= 0)
            {
                currentChar = turkishString[index].ToString();
                string x = TurkishUpcaseAccentsTable.ContainsKey(currentChar) ? TurkishUpcaseAccentsTable[currentChar] : null;

                if (x == null)
                {
                    if (!space)
                    {
                        i--;
                        space = true;
                    }
                }
                else
                {
                    s
                        = setCharAt(s, i, x);
                    i--;
                    space = false;
                }
                index--;
            }

            return(s);
        }